JOBHACK is a comprehensive job application platform that allows users to register, log in, post jobs, and apply for jobs. The platform is built with a robust tech stack, including React.js for the frontend and Node.js with Express.js for the backend. The project is deployed with the frontend on Netlify and the backend on Render.
- [Features]
- [Tech Stack]
- [Installation]
- [Usage]
- [API Endpoints]
- [Environment Variables]
- [File Structure]
- [Deployment]
- User Authentication
- Register
- Login
- JWT-based authentication
- Job Listings
- View all jobs
- View job details
- Post a job (Employer)
- Manage posted jobs (Employer)
- Job Applications
- Apply for jobs (Job Seeker)
- View and manage applications (Job Seeker)
- View applications for posted jobs (Employer)
- Notifications using React Hot Toast
- Role-based access control
Frontend:
- React.js
- React Router
- Axios
- React Context API
- React Hot Toast
Backend:
- Node.js
- Express.js
- MongoDB
- Mongoose
- JWT
- dotenv
- cors
- cookie-parser
- express-fileupload
Deployment:
- Frontend: Netlify
- Backend: Render
- Node.js
- MongoDB
-
Clone the repository:
git clone https://github.com/your-username/jobhack.git cd jobhack/backend
-
Install dependencies:
npm install
-
Create a
.env
file in thebackend
directory and add your environment variables:PORT=3000 MONGO_URI=your_mongodb_uri JWT_SECRET_KEY=your_jwt_secret_key COOKIE_EXPIRE=7
-
Start the backend server:
npm start
-
Navigate to the
frontend
directory:cd ../frontend
-
Install dependencies:
npm install
-
Create a
helper.js
file in thefrontend/src
directory and add your base URL:export const BASE_URL = "http://localhost:3000";
-
Start the frontend development server:
npm start
- Register a new user or log in with an existing account.
- As an employer, you can post new jobs and manage your posted jobs.
- As a job seeker, you can view job listings, apply for jobs, and manage your applications.
POST /api/v1/user/register
- Register a new userPOST /api/v1/user/login
- Login a userGET /api/v1/user/getUser
- Get the current authenticated user
GET /api/v1/job/getAll
- Get all job listingsGET /api/v1/job/:jobId
- Get a specific job's detailsPOST /api/v1/job/post
- Post a new job (Employer only)PUT /api/v1/job/update/:jobId
- Update a job (Employer only)DELETE /api/v1/job/delete/:jobId
- Delete a job (Employer only)GET /api/v1/job/me
- Get jobs posted by the authenticated employer
POST /api/v1/application/apply/:jobId
- Apply for a job (Job Seeker only)GET /api/v1/application/getAll
- Get all applications for the authenticated userDELETE /api/v1/application/delete/:id
- Delete an application (Job Seeker only)
The following environment variables need to be set in your .env
file:
PORT
: The port on which the backend server will run.MONGO_URI
: The MongoDB connection URI.JWT_SECRET_KEY
: The secret key for signing JWT tokens.COOKIE_EXPIRE
: The number of days until the JWT token expires.
src/
components/
Auth/
(Login, Register components)Layout/
(Navbar, Footer components)Home/
(Home component)Job/
(Jobs, JobDetails, PostJob, MyJobs components)Application/
(Application, MyApplications components)NotFound/
(NotFound component)
App.js
(Main app component with routing)main.jsx
(React Context provider setup)helper.js
(Utility functions and constants)
routes/
userRouter.js
(User-related routes)jobRouter.js
(Job-related routes)applicationRouter.js
(Application-related routes)
middlewares/
error.js
(Error handling middleware)headers.js
(Headers middleware for CORS and other configurations)
controllers/
userController.js
(Handles user-related logic)jobController.js
(Handles job-related logic)applicationController.js
(Handles application-related logic)
models/
userSchema.js
(Mongoose schema for users)jobSchema.js
(Mongoose schema for jobs)applicationSchema.js
(Mongoose schema for applications)
utils/
jwtToken.js
(JWT token handling logic)catchAsyncError.js
(Utility to catch async errors in route handlers)error.js
(Custom error class)
config/
config.env
(Environment variables)
-
Create a
netlify.toml
file in the root of your frontend directory:[build] base = "frontend" publish = "dist" command = "npm run build" [[redirects]] from = "/*" to = "/index.html" status = 200
-
Push your frontend code to a Git repository.
-
Login to Netlify and create a new site from your Git repository.
-
Netlify will automatically detect the
netlify.toml
file and deploy your site.
-
Push your backend code to a Git repository.
-
Login to Render and create a new web service.
-
Connect your Git repository and configure the environment variables.
-
Deploy the service.