A full-stack web application for managing faculty workloads in a college. Built with React, Node.js/Express, and MySQL.
| Layer | Technology |
|---|---|
| Frontend | React 18, Vite, Tailwind CSS, Recharts |
| Backend | Node.js, Express.js |
| Database | MySQL (via mysql2) |
| Auth | JWT + bcryptjs |
| Icons | Lucide React |
faculty-workload-system/
├── backend/
│ ├── src/
│ │ ├── config/db.js
│ │ ├── controllers/
│ │ ├── middleware/auth.js
│ │ └── routes/
│ ├── .env
│ └── package.json
├── frontend/
│ ├── src/
│ │ ├── api/api.js
│ │ ├── components/
│ │ ├── context/
│ │ └── pages/
│ └── package.json
└── database/
├── schema.sql
└── seed.sql
# Login to MySQL
mysql -u root -p
# Run schema
source /path/to/database/schema.sql
# Run seed data
source /path/to/database/seed.sqlIMPORTANT: The seed file uses a placeholder password hash. Before running, generate correct bcrypt hashes:
node -e "const b=require('bcryptjs'); b.hash('your_password',10).then(h=>console.log(h))"Replace the $2b$10$... values in seed.sql with your generated hashes.
Demo credentials (after seeding):
- Admin:
admin@college.edu/ (your chosen password) - Faculty:
anitha@college.edu/ (your chosen password)
cd backend
npm install
# Configure .env (already created):
# PORT=5000
# DB_HOST=localhost
# DB_USER=root
# DB_PASSWORD=3185 ← change to your MySQL password
# DB_NAME=faculty_workload_db
# JWT_SECRET=faculty_workload_super_secret_2024
npm run dev
# Server runs at http://localhost:5000cd frontend
npm install
npm run dev
# App runs at http://localhost:5173- JWT stored in
localStorage - Auto-redirects to
/loginon 401 - Role-based routing: Admin →
/admin, Faculty →/faculty - All API routes protected by JWT middleware
- Dashboard with charts (workload bar, status pie, dept chart)
- Faculty CRUD (add, edit, delete)
- Subject CRUD with department/semester filters
- Department management
- Subject allocation with overload prevention
- Workload management with color-coded status
- Request & Leave approval/rejection
- Notifications/announcements system
- CSV report generation with filters
- Personal dashboard with workload donut chart
- View assigned subjects
- Workload breakdown by duty type
- Leave management (apply, track)
- Workload requests (submit, track)
- Notifications with mark-as-read
- Own CSV report download
- Profile management
- Light/Dark mode toggle (persisted in localStorage)
- Pastel color palette: soft blues, lavenders, mint greens, peach
- Clean sidebar navigation per role
- Responsive cards, tables, charts
- Toast notifications for all actions
| Method | Path | Description |
|---|---|---|
| POST | /api/auth/login | Login |
| POST | /api/auth/register-faculty | Add faculty (admin) |
| GET | /api/auth/me | Get current user |
| PUT | /api/auth/profile | Update profile |
| GET | /api/faculty | List all faculty |
| GET | /api/subjects | List all subjects |
| GET/POST | /api/departments | Departments CRUD |
| GET/POST | /api/allocations | Allocations |
| GET | /api/allocations/my | Faculty's own allocations |
| GET | /api/allocations/summary | Workload summary (admin) |
| GET | /api/allocations/report | Report data |
| POST | /api/leaves | Apply for leave |
| GET | /api/leaves/my | Own leaves |
| GET | /api/leaves/all | All leaves (admin) |
| POST | /api/requests | Submit request |
| GET | /api/dashboard/admin | Admin dashboard data |
| GET | /api/dashboard/faculty | Faculty dashboard data |
| GET | /api/notifications | Get notifications |
| POST | /api/notifications | Send notification (admin) |
- CORS error: Ensure backend is running on port 5000 before starting frontend
- DB connection: Check your
.envDB credentials match your MySQL setup - Invalid token: Clear localStorage and re-login
- Overload warning: Admin receives a 400 error if allocation would exceed faculty max hours