A full-stack Mini Job Portal web app with Role-Based Login, where Employers can post/manage jobs and Job Seekers can browse and apply.
Built using Node.js, Express, React (Ant Design), Sequelize (MySQL/PostgreSQL), and JWT Authentication.
| Layer | Technology |
|---|---|
| Backend | Node.js, Express.js |
| Database | MySQL / PostgreSQL |
| ORM | Sequelize |
| Frontend | React + Ant Design (AntD) |
| HTTP Client | Axios |
| Authentication | JWT (JSON Web Token) |
| Tools | Nodemon, Concurrently, Vite |
(root)
│
├── backend/
│ ├── src/
│ │ ├── server.js
│ │ ├── models/
│ │ ├── routes/
│ │ ├── controllers/
│ │ ├── middleware/
│ │ └── config/
│ └── package.json
│
├── frontend/
│ ├── src/
│ └── package.json
│
├── package.json
└── README.md
---
## ⚙️ Setup Instructions
### 1️⃣ Clone the Repository
```bash
git clone <your-repo-url>
cd mini-job-portal
```
### 2️⃣ Install Dependencies
#### Backend
```bash
cd backend
npm install
```
#### Frontend
```bash
cd ../frontend
npm install
```
#### Root (optional)
```bash
cd ..
npm install
```
---
## 🧩 Environment Variables
### Backend → `/backend/.env`
```env
PORT=5000
# JWT Configuration
JWT_SECRET=your_jwt_secret
JWT_EXPIRES_IN=7d
# DATABASE (MySQL Example)
DB_DIALECT=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_USER=root
DB_PASSWORD=your_password
DB_NAME=mini_job_portal
# (PostgreSQL Example)
# DB_DIALECT=postgres
# DB_PORT=5432
```
### Frontend → `/frontend/.env`
```env
VITE_API_BASE_URL=http://localhost:5000/api
```
---
## 🗄️ Database Setup
### Create Database
**MySQL Example:**
```sql
CREATE DATABASE mini_job_portal;
```
**PostgreSQL Example:**
```sql
CREATE DATABASE mini_job_portal;
```
Then update your `.env` file with correct credentials.
---
## ▶️ Run the Project
### Run Backend Only
```bash
cd backend
npm run dev
```
### Run Frontend Only
```bash
cd frontend
npm run dev
```
### Run Both (Concurrently from Root)
```bash
npm run start:all
```
✅ This will start:
- **Backend API** → [http://localhost:5000](http://localhost:5000)
- **Frontend (Vite)** → [http://localhost:5173](http://localhost:5173)
---
## 🔐 Authentication API
### Register User
**POST** `/auth/register`
```json
{
"name": "John Doe",
"email": "john@example.com",
"password": "securepass",
"role": "employer" // or "seeker"
}
```
### Login User
**POST** `/auth/login`
```json
{
"email": "john@example.com",
"password": "securepass"
}
```
**Response:**
```json
{
"token": "Bearer <jwt_token>",
"user": {
"id": 1,
"name": "John",
"role": "employer"
}
}
```
---
## 💼 Employer APIs
| Method | Endpoint | Description |
| ------ | ----------------------- | ------------------------------------- |
| POST | `/jobs` | Create a new job _(Employer only)_ |
| GET | `/jobs/my` | Get jobs posted by logged-in employer |
| GET | `/applications/:job_id` | View all applications for a job |
| PUT | `/applications/:id` | Update application status |
---
## 👨💻 Job Seeker APIs
| Method | Endpoint | Description |
| ------ | ------------------ | ------------------------------- |
| GET | `/jobs` | Get all jobs (filterable) |
| GET | `/jobs/:id` | View job details |
| POST | `/applications` | Apply for a job _(Seeker only)_ |
| GET | `/applications/my` | View seeker’s applications |
---
## 🧱 Sequelize Sync (DB Models)
Add this inside `src/server.js` to auto-sync models:
```js
const db = require('./models');
db.sequelize
.sync({ alter: true })
.then(() => {
console.log('✅ Database synced successfully');
})
.catch((err) => console.error('❌ Sync error:', err));
```
---
## 🧰 Useful Commands
| Command | Description |
| ------------------- | ----------------------------------- |
| `npm run dev` | Start backend with Nodemon |
| `npm start` | Start backend in production |
| `npm run start:all` | Run backend + frontend concurrently |
| `npm run build` | Build React app |
| `npm run preview` | Preview production build (Vite) |
---
## 🧾 License
This project is open-sourced under the **MIT License**.
---
## 👨💻 Author
**Mini Job Portal**
Developed using **Node.js**, **Express**, **Sequelize**, **PostgreSQL**, **React**, and **Ant Design**.
```