This is the backend of the full-stack role-based employee management system built with Node.js, Express, MongoDB, and Firebase Admin SDK. It includes secure JWT authentication, role-based authorization (Admin, HR, Employee), salary/payroll management with Stripe, and fully protected API routes.
🔗 Live Demo: View Live Site
📦 Frontend: View Frontend Repository
🔗 API Base URL: https://employee-management-server-ebon.vercel.app/
- Firebase ID token verification (Email/Password & Google)
- JWT issuance after login
- Role-based authorization using custom middleware
- Users who are fired are automatically disabled in Firebase and cannot log in again
| Role | Capabilities |
|---|---|
| Admin | Fire users, update salaries, approve payroll requests |
| HR | Verify employees, submit salary requests, monitor work progress |
| Employee | Submit work sheets, view their own payment history |
- Firebase login returns a token → Sent to backend
- Backend verifies token → issues JWT → Stored in HTTP-only cookie
- All protected routes check for JWT + Role
- Node.js + Express
- MongoDB + Mongoose
- Firebase Admin SDK – For managing user disable logic
- jsonwebtoken (JWT) – Secure session auth
- Stripe – For salary payments (Admin only)
- cookie-parser, cors, dotenv – Utility middleware