Every workday, perfectly aligned.
A modern, full-stack Human Resource Management System (HRMS) built with the MERN stack (MongoDB, Express, React, Node.js). DayFlow streamlines core HR operations including employee management, attendance tracking, leave management, and payroll visibility with a beautiful, professional UI.
- Auto-generated Employee ID system (Format: OIJODO20220001)
- System-generated passwords for new employees
- Secure JWT-based authentication
- Role-based access control (Admin, HR, Employee)
- Password encryption with bcrypt
- Forced password change on first login
- Admin/HR-only employee creation (no public registration)
- Email verification support
See AUTHENTICATION_GUIDE.md for detailed information
- Complete employee profile management
- Personal and job details tracking
- Document management
- Employee directory with search
- Role-based profile editing
- Daily check-in/check-out functionality
- Visual calendar view of attendance
- Monthly attendance reports
- Work hours calculation
- Attendance status (Present, Absent, Half-day, Leave)
- Apply for different leave types (Paid, Sick, Unpaid)
- Leave balance tracking
- Leave request approval workflow
- Leave history and status tracking
- Automatic leave balance deduction
- Salary structure with allowances and deductions
- Gross and net salary calculation
- Detailed salary breakdown
- Payroll history
- Payment status tracking
- Beautiful gradient design
- Responsive layout for all devices
- Smooth animations and transitions
- Intuitive navigation
- Professional dashboard views
- Real-time notifications
- Node.js - JavaScript runtime
- Express.js - Web framework
- MongoDB - NoSQL database
- Mongoose - MongoDB ODM
- JWT - Authentication
- bcryptjs - Password hashing
- express-validator - Input validation
- React - UI library
- React Router - Navigation
- Axios - HTTP client
- date-fns - Date manipulation
- lucide-react - Icon library
- react-hot-toast - Notifications
- Context API - State management
Before you begin, ensure you have the following installed:
- Node.js (v18 or higher) - Download
- MongoDB (v4.4 or higher) - Download
- npm or yarn - Comes with Node.js
git clone <repository-url>
cd DayFlow# Navigate to backend directory
cd backend
# Install dependencies
npm install
# Configure environment variables
# Copy .env.example to .env and update the values
cp .env.example .env
# Start MongoDB (if not running)
# On Windows: Start MongoDB service from Services
# On Mac/Linux: sudo systemctl start mongod
# Create the first admin account
node createAdmin.js
# This will create an admin account with Employee ID: OIADMN20230001
# Default password: admin123 (change after first login!)
# Start the backend server
npm run devThe backend server will start on http://localhost:5000
# Open a new terminal and navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Start the development server
npm startThe frontend application will open at http://localhost:3000
PORT=5000
MONGODB_URI=mongodb://localhost:27017/dayflow
JWT_SECRET=your_jwt_secret_key_here_change_in_production
JWT_EXPIRE=7d
NODE_ENV=developmentDayFlow/
βββ backend/
β βββ models/
β β βββ Employee.js
β β βββ Attendance.js
β β βββ Leave.js
β β βββ Payroll.js
β βββ routes/
β β βββ auth.js
β β βββ employees.js
β β βββ attendance.js
β β βββ leave.js
β β βββ payroll.js
β βββ middleware/
β β βββ auth.js
β βββ .env
β βββ package.json
β βββ server.js
βββ frontend/
β βββ public/
β βββ src/
β β βββ components/
β β β βββ Layout.js
β β β βββ PrivateRoute.js
β β βββ context/
β β β βββ AuthContext.js
β β βββ pages/
β β β βββ SignIn.js
β β β βββ ChangePassword.js
β β β βββ CreateEmployee.js
β β β βββ EmployeeDashboard.js
β β β βββ AdminDashboard.js
β β β βββ Profile.js
β β β βββ Attendance.js
β β β βββ LeaveManagement.js
β β β βββ PayrollManagement.js
β β β βββ EmployeeList.js
β β βββ utils/
β β β βββ api.js
β β βββ App.js
β β βββ index.js
β βββ package.json
βββ README.md
- View personal dashboard
- Check-in/Check-out for attendance
- View attendance history
- Apply for leave
- View leave status
- View payroll information
- Edit limited profile fields (phone, address, profile picture)
- All employee permissions
- Create new employee accounts with auto-generated credentials
- View all employees
- Manage employee profiles
- View all attendance records
- Approve/reject leave requests
- Manage payroll records
- Access admin dashboard
- Start MongoDB - Ensure MongoDB is running
- Install Dependencies - Run
npm installin both backend and frontend - Create Admin Account - Run
node createAdmin.jsin the backend directory - Start Servers - Run backend (
npm run dev) and frontend (npm start)
- Navigate to
http://localhost:3000/signin - Login with default admin credentials:
- Employee ID:
OIADMN20230001 - Password:
admin123
- Employee ID:
β οΈ Important: Change the default password after first login!
- Login as Admin/HR
- Click the "Create Employee" button on the Admin Dashboard
- Fill in employee details (name, email, phone, position, department, etc.)
- Click "Create Employee"
- Save the generated credentials displayed in the modal:
- Employee ID (e.g., OIJODO20220001)
- Temporary Password (e.g., a7f3c8d1)
- Share these credentials securely with the new employee
- Receive Employee ID and temporary password from HR/Admin
- Go to
http://localhost:3000/signin - Enter Employee ID and temporary password
- You'll be automatically redirected to change your password
- Enter current password and create a new password
- Login again with your new password
DayFlow uses an auto-generated Employee ID system for enhanced security:
- Employee ID Format:
OI[FirstName2][LastName2][Year][SerialNum4]- Example: John Doe joining 2022 β
OIJODO20220001
- Example: John Doe joining 2022 β
- No public registration - Only Admin/HR can create accounts
- System-generated passwords - Random secure passwords for new employees
- Forced password change - New employees must change password on first login
π For detailed authentication documentation, see AUTHENTICATION_GUIDE.md
POST /api/auth/create-employee - Create new employee (Admin/HR only)
POST /api/auth/signin - Login with Employee ID
PUT /api/auth/change-password - Change password
POST /api/auth/signin - Login
GET /api/auth/me - Get current user
GET /api/employees - Get all employees (Admin/HR)
GET /api/employees/:id - Get employee by ID
PUT /api/employees/:id - Update employee
DELETE /api/employees/:id - Delete employee (Admin)
GET /api/attendance - Get attendance records
POST /api/attendance - Create attendance (Admin/HR)
POST /api/attendance/checkin - Employee check-in
POST /api/attendance/checkout - Employee check-out
PUT /api/attendance/:id - Update attendance (Admin/HR)
DELETE /api/attendance/:id - Delete attendance (Admin)
GET /api/leave - Get leave requests
POST /api/leave - Apply for leave
PUT /api/leave/:id/review - Approve/reject leave (Admin/HR)
DELETE /api/leave/:id - Delete leave request
GET /api/payroll - Get payroll records
GET /api/payroll/:id - Get specific payroll
POST /api/payroll - Create payroll (Admin/HR)
PUT /api/payroll/:id - Update payroll (Admin/HR)
DELETE /api/payroll/:id - Delete payroll (Admin)
- Employee Dashboard: Personal stats, quick attendance check-in, recent leave requests
- Admin Dashboard: Organization overview, attendance metrics, pending leave approvals
- Interactive calendar view
- Color-coded attendance status
- Work hours tracking
- Monthly statistics
- Simple leave application form
- Real-time leave balance
- Status tracking (Pending/Approved/Rejected)
- Admin approval workflow
- Detailed salary breakdown
- Earnings and deductions
- Payment history
- Professional salary slips view
- JWT-based authentication
- Password hashing with bcrypt
- Role-based access control
- Protected API routes
- Input validation
- XSS protection
- CORS configuration
DayFlow is fully responsive and works seamlessly on:
- π» Desktop
- π± Tablets
- π Mobile devices
# Check if MongoDB is running
# Windows: Check Services
# Mac/Linux: sudo systemctl status mongod
# If not running, start it
# Mac/Linux: sudo systemctl start mongod# Backend (Port 5000)
# Find and kill the process using port 5000
# Windows: netstat -ano | findstr :5000
# Mac/Linux: lsof -ti:5000 | xargs kill
# Frontend (Port 3000)
# The React dev server will offer to use a different port# Clear node_modules and reinstall
rm -rf node_modules package-lock.json
npm install- Create a Heroku app
- Set environment variables
- Deploy using Git
- Build the production version:
npm run build - Deploy the build folder
- Create a free cluster
- Update MONGODB_URI in .env
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the ISC License.
Built with β€οΈ using MERN Stack
- Icons by Lucide
- UI inspiration from modern HR systems
- Built with best practices and clean code
For issues and questions:
- Create an issue in the repository
- Check existing documentation
DayFlow - Making every workday flow perfectly! β‘