- Kalp Modi
- Nevil Dhaduk
- Dhruvi Radadiya
- Dhwani Vyas
A comprehensive full-stack Human Resources Management System built with React, Node.js, Express, and PostgreSQL. Features a modern Odoo-inspired UI with complete employee management, attendance tracking, leave management, and payroll processing capabilities.
- JWT-based user authentication
- Role-based access control (Admin, HR, Employee)
- Secure password hashing with bcrypt
- Protected API routes and frontend pages
- Complete CRUD operations for employees
- Employee profile management
- Department and designation tracking
- Salary management
- HR/Admin can add and delete employees
- Check-in/Check-out functionality
- Automatic total hours calculation
- Daily attendance records
- Attendance history tracking
- Leave application system
- Leave approval/rejection workflow
- Paid and unpaid leave tracking
- Leave history and status tracking
- Automatic payroll generation
- Salary calculation based on working days
- Present days and leave deduction
- PF and Tax calculations
- Net salary computation
- Attendance summary reports
- Payroll summary reports
- Employee statistics
- Data export capabilities
- PDF payslip generation
- Payslip download functionality
- Detailed salary breakdown
- Professional payslip formatting
- Modern, responsive Odoo-inspired UI design
- Clean and professional interface
- Real-time data updates
- Interactive dashboard with statistics
- Role-based UI components
- Smooth transitions and animations
iitgn/
βββ backend/ # Node.js backend API
β βββ src/
β β βββ controllers/ # Business logic controllers
β β βββ routes/ # API route definitions
β β βββ middleware/ # Authentication middleware
β β βββ utils/ # Utility functions
β β βββ types/ # TypeScript type definitions
β β βββ app.ts # Express app configuration
β β βββ server.ts # Server entry point
β βββ prisma/
β β βββ schema.prisma # Database schema
β β βββ migrations/ # Database migrations
β βββ scripts/ # Utility scripts
β β βββ seed-users.js # User seeding script
β β βββ seed-employees.js # Employee seeding script
β βββ docker-compose.yml # Docker services configuration
β βββ Dockerfile # Backend Docker image
β βββ package.json
βββ frontend/ # React frontend application
β βββ src/
β β βββ components/ # React components
β β β βββ Login.tsx
β β β βββ Dashboard.tsx
β β β βββ Employees.tsx
β β β βββ Attendance.tsx
β β β βββ Payroll.tsx
β β β βββ Layout.tsx
β β βββ context/ # React contexts
β β β βββ AuthContext.tsx
β β βββ services/ # API service layer
β β β βββ api.ts
β β βββ App.tsx # Main app component
β β βββ main.tsx # Entry point
β β βββ index.css # Global styles
β βββ package.json
β βββ vite.config.ts
βββ README.md # This file
- Runtime: Node.js 20+
- Framework: Express.js
- Language: TypeScript
- Database: PostgreSQL 16
- ORM: Prisma
- Authentication: JWT (jsonwebtoken)
- Password Hashing: bcryptjs
- PDF Generation: PDFKit
- Containerization: Docker & Docker Compose
- Framework: React 18
- Language: TypeScript
- Build Tool: Vite
- Styling: Tailwind CSS
- Routing: React Router
- HTTP Client: Axios
- State Management: React Context API
Before you begin, ensure you have the following installed:
- Node.js 18+ and npm
- Docker and Docker Compose
- Git (for cloning the repository)
git clone <repository-url>
cd iitgncd backendcp .env.example .envEdit .env file with your configuration if needed.
docker-compose up -d postgresWait a few seconds for PostgreSQL to be ready.
docker-compose exec backend npx prisma migrate devOr run individual migrations:
docker-compose exec backend npx prisma migrate dev --name init_auth
docker-compose exec backend npx prisma migrate dev --name add_employee
docker-compose exec backend npx prisma migrate dev --name add_attendance
docker-compose exec backend npx prisma migrate dev --name add_leave_module
docker-compose exec backend npx prisma migrate dev --name add_payrollCreate test users and employees:
# Seed users only
npm run seed:users
# Seed employees only
npm run seed:employees
# Seed both users and employees
npm run seed:allThis will create:
- 3 test users: Admin, HR, and Employee accounts
- 6 sample employees with different departments and roles
docker-compose upThe backend will be running on http://localhost:4000
cd ../frontendnpm installnpm run devThe frontend will be running on http://localhost:3000
After seeding the database, you can use these test accounts:
| Role | Password | |
|---|---|---|
| Admin | admin@example.com | admin123 |
| HR | hr@example.com | hr123 |
| Employee | employee@example.com | emp123 |
-
POST /api/auth/register- Register a new user{ "name": "John Doe", "email": "john@example.com", "password": "password123", "role": "EMPLOYEE" // Optional: ADMIN, HR, or EMPLOYEE } -
POST /api/auth/login- Login user{ "email": "admin@example.com", "password": "admin123" } -
GET /api/auth/profile- Get current user profile (Protected)
GET /api/employees- Get all employees (Protected)GET /api/employees/:id- Get employee by ID (Protected)POST /api/employees- Create new employee (Protected, HR/Admin only){ "name": "Jane Smith", "email": "jane@example.com", "department": "Engineering", "designation": "Software Engineer", "salary": 75000, "status": "ACTIVE" }PUT /api/employees/:id- Update employee (Protected, HR/Admin only)DELETE /api/employees/:id- Delete employee (Protected, HR/Admin only)
-
POST /api/attendance/checkin- Check in for today (Protected){ "employeeId": 1 } -
POST /api/attendance/checkout- Check out for today (Protected){ "employeeId": 1 } -
GET /api/attendance/employee/:employeeId- Get employee attendance (Protected) -
GET /api/attendance/date?date=YYYY-MM-DD- Get attendance by date (Protected)
-
POST /api/leaves- Apply for leave (Protected){ "employeeId": 1, "startDate": "2025-01-15", "endDate": "2025-01-17", "type": "PAID", "reason": "Personal work" } -
GET /api/leaves- Get all leaves (Protected) -
GET /api/leaves/employee/:employeeId- Get employee leaves (Protected) -
PUT /api/leaves/:id/review- Approve/reject leave (Protected, HR/Admin only){ "status": "APPROVED", // or "REJECTED" "reviewedBy": 1 }
-
POST /api/payroll/generate- Generate payroll (Protected){ "employeeId": 1, "month": "2025-01" } -
GET /api/payroll- Get all payrolls (Protected)- Query params:
?employeeId=1&month=2025-01
- Query params:
-
GET /api/payroll/:id- Get payroll by ID (Protected)
GET /api/payslip/:id/pdf- Download payslip PDF (Protected)
-
GET /api/reports/attendance-summary- Get attendance summary (Protected)- Query params:
?from=2025-01-01&to=2025-01-31
- Query params:
-
GET /api/reports/payroll-summary- Get payroll summary (Protected)- Query params:
?from=2025-01-01&to=2025-01-31
- Query params:
- Odoo-inspired modern and clean interface
- Purple, Yellow, and White color scheme
- Rounded corners and subtle shadows
- Smooth transitions and animations
- Responsive design for all screen sizes
- Professional typography and spacing
- Login Page: Clean authentication interface
- Dashboard: Overview with statistics cards
- Employees: Employee management with add/delete functionality (HR/Admin only)
- Attendance: Check-in/check-out interface
- Payroll: Payroll generation and management with PDF download
- Admin/HR: Full access to all features including employee management
- Employee: View-only access to personal information and attendance
You can test the API using:
-
PowerShell (Windows):
# Login $response = Invoke-RestMethod -Uri "http://localhost:4000/api/auth/login" ` -Method POST ` -Headers @{ "Content-Type" = "application/json" } ` -Body '{"email":"admin@example.com","password":"admin123"}' $token = $response.token
-
Postman or Thunder Client (VS Code extension)
-
curl:
curl -X POST http://localhost:4000/api/auth/login \ -H "Content-Type: application/json" \ -d '{"email":"admin@example.com","password":"admin123"}'
- Start both backend and frontend servers
- Open
http://localhost:3000in your browser - Login with test credentials
- Navigate through different pages and test features
cd backend
# Start PostgreSQL
docker-compose up -d postgres
# Run migrations
docker-compose exec backend npx prisma migrate dev
# Start backend in development mode
docker-compose upcd frontend
# Install dependencies
npm install
# Start development server
npm run dev# Generate Prisma Client
cd backend
docker-compose exec backend npx prisma generate
# Open Prisma Studio (Database GUI)
docker-compose exec backend npx prisma studio
# Reset database (CAUTION: Deletes all data)
docker-compose exec backend npx prisma migrate resetcd backend
# Build Docker image
docker-compose build
# Start services in production mode
docker-compose up -d
# View logs
docker-compose logs -f backendcd frontend
# Build for production
npm run build
# Preview production build
npm run preview
# The built files will be in the `dist` directory
# Serve with a web server like nginx, Apache, or a CDN# PostgreSQL
POSTGRES_USER=hrms_user
POSTGRES_PASSWORD=hrms_pass
POSTGRES_DB=hrms_db
# Prisma connection string
DATABASE_URL="postgresql://hrms_user:hrms_pass@postgres:5432/hrms_db?schema=public"
# Server
PORT=4000
# JWT
JWT_SECRET=super_secret_change_this_for_prod
JWT_EXPIRES_IN=7d
# Frontend URL (for CORS)
FRONTEND_URL=http://localhost:3000VITE_API_URL=http://localhost:4000/api- Password hashing with bcrypt (10 salt rounds)
- JWT token-based authentication
- Protected API routes with middleware
- CORS configuration
- Input validation
- SQL injection prevention (Prisma ORM)
- XSS protection
The database schema includes:
- User: Authentication and user management
- Employee: Employee information and details
- Attendance: Daily attendance records
- Leave: Leave applications and approvals
- Payroll: Payroll records and calculations
See backend/prisma/schema.prisma for detailed schema definition.
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License.
For issues, questions, or suggestions:
- Open an issue on GitHub
- Contact the development team
- Check the documentation in
backend/README.mdandfrontend/README.md
Potential features for future development:
- Email notifications
- Advanced reporting and analytics
- Employee performance tracking
- Document management
- Multi-language support
- Mobile app
- Real-time notifications
- Advanced search and filtering
- Data export (CSV, Excel)
- Audit logs
- Built with modern web technologies
- Inspired by Odoo's clean UI design
- Uses industry-standard security practices
Happy Coding! π