A modern, lightweight Human Resource Management System for tracking employees and attendance. Built with a React + Vite frontend and FastAPI + SQLAlchemy backend, featuring real-time dashboards, comprehensive validation, and a responsive mobile-first design.
- Overview
- Features
- Technology Stack
- Prerequisites
- Installation
- Usage Guide
- API Reference
- Testing
- Deployment
- Project Structure
- Contributing
- License
HRMS Lite is a full-stack web application designed to simplify employee management and attendance tracking for small to medium-sized organizations. The system provides an intuitive interface for HR personnel to manage employee records, mark daily attendance, and view real-time statistics through an interactive dashboard.
- Real-time Dashboard: Live statistics with interactive charts powered by Recharts
- Mobile-First Design: Fully responsive UI with optimized touch interactions
- Comprehensive Validation: Both client-side and server-side validation with detailed error messages
- RESTful API: Well-documented API with OpenAPI/Swagger documentation
- High Test Coverage: 70%+ code coverage with unit, integration, and E2E tests
- Production Ready: Configured for deployment on Render (backend) and Vercel (frontend)
| Feature | Description |
|---|---|
| Add Employees | Create new employee records with validated fields (ID, name, email, department) |
| Search & Filter | Real-time search by name, employee ID, or email address |
| Update Records | Edit employee information with conflict prevention |
| Delete Records | Remove employees with cascading attendance record cleanup |
| Duplicate Prevention | Automatic detection of duplicate employee IDs and emails |
| Feature | Description |
|---|---|
| Mark Attendance | Record daily attendance (Present/Absent) for any employee |
| Date Validation | Prevents marking attendance for future dates |
| Duplicate Prevention | One attendance record per employee per day |
| Filter Records | Filter by employee, date range, or attendance status |
| Today's Overview | Quick view of today's attendance status for all employees |
| Feature | Description |
|---|---|
| Statistics Overview | Total employees, departments, and attendance rate |
| Today's Summary | Present, absent, and unmarked counts |
| Department Breakdown | Bar chart visualization of employees by department |
| Attendance Pie Chart | Visual breakdown of today's attendance |
| Recent Employees | List of recently added team members |
- Dark Theme: Modern gradient-based design with smooth transitions
- Responsive Layout: Optimized for desktop, tablet, and mobile devices
- Bottom Navigation: Mobile-friendly navigation bar
- Loading States: Spinner components for async operations
- Alert System: Contextual notifications for success, error, and warning states
- Modal Dialogs: Accessible modals for forms and confirmations
| Technology | Version | Purpose |
|---|---|---|
| React | 19.x | UI component library |
| Vite | 7.x | Build tool and dev server |
| React Router | 7.x | Client-side routing |
| Axios | 1.x | HTTP client |
| Recharts | 3.x | Data visualization |
| React Icons | 5.x | Icon library |
| date-fns | 4.x | Date manipulation |
| Bootstrap | 5.x | CSS framework |
| Technology | Version | Purpose |
|---|---|---|
| FastAPI | 0.115+ | Web framework |
| SQLAlchemy | 2.x | ORM and database toolkit |
| Pydantic | 2.x | Data validation |
| Uvicorn | 0.30+ | ASGI server |
| PostgreSQL | 12+ | Primary database |
| SQLite | - | Testing database (in-memory) |
| Technology | Purpose |
|---|---|
| pytest | Backend unit/integration tests |
| pytest-cov | Coverage reporting |
| Vitest | Frontend unit tests |
| Playwright | End-to-end testing |
| Factory Boy | Test data generation |
| Testing Library | React testing utilities |
Before installing HRMS Lite, ensure you have the following installed:
| Requirement | Minimum Version | Verification Command |
|---|---|---|
| Python | 3.11+ | python --version |
| Node.js | 18+ | node --version |
| npm | 9+ | npm --version |
| PostgreSQL | 12+ | psql --version |
| Git | 2.x | git --version |
git clone https://github.com/abhayror17/hrms-lite.git
cd hrms-lite# Navigate to backend directory
cd backend
# Create virtual environment
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Create environment file
copy .env.example .env # Windows
# cp .env.example .env # macOS/LinuxEdit the .env file with your database credentials:
DATABASE_URL=postgresql://username:password@localhost:5432/hrms_lite
CORS_ORIGINS=http://localhost:5173,http://localhost:3000Create the PostgreSQL database:
# Using psql
psql -U postgres
CREATE DATABASE hrms_lite;
\q
# Or using createdb
createdb -U postgres hrms_liteInitialize and start the server:
# Start the development server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000The backend will be available at:
- API: http://localhost:8000
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
Open a new terminal:
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Start development server
npm run devThe frontend will be available at http://localhost:5173
The dashboard provides a real-time overview of your HR data:
- Statistics Cards: View total employees, department count, attendance rate, and today's present count
- Attendance Chart: Pie chart showing today's attendance breakdown (Present/Absent/Not Marked)
- Department Chart: Horizontal bar chart showing employee distribution across departments
- Recent Employees: Quick list of the 5 most recently added employees
Adding an Employee:
- Navigate to Employees page
- Click Add Employee button
- Fill in the required fields:
- Employee ID: Unique identifier (e.g., EMP001)
- Full Name: Employee's full name
- Email: Valid email address (must be unique)
- Department: Department name
- Click Add Employee to save
Editing an Employee:
- Click the Edit (pencil) icon on the employee row
- Modify the desired fields
- Click Update to save changes
Deleting an Employee:
- Click the Delete (trash) icon on the employee row
- Confirm the deletion in the modal dialog
- Note: This will also delete all attendance records for this employee
Marking Attendance:
- Navigate to Attendance page
- Click Mark Attendance button
- Select the employee from the dropdown
- Choose the date (cannot be in the future)
- Select status: Present or Absent
- Click Mark Attendance to save
Filtering Attendance Records:
Use the filter options at the top of the attendance page:
- Employee: Filter by specific employee
- From Date: Start of date range
- To Date: End of date range
- Status: Filter by Present or Absent
For complete API documentation, see API.md or visit the interactive documentation at /docs when running the backend.
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/employees/ |
Create a new employee |
GET |
/api/employees/ |
List all employees (with optional filters) |
GET |
/api/employees/{id} |
Get employee by UUID |
PUT |
/api/employees/{id} |
Update employee |
DELETE |
/api/employees/{id} |
Delete employee |
GET |
/api/employees/{id}/summary |
Get attendance summary |
GET |
/api/employees/dashboard/stats |
Get dashboard statistics |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/attendance/ |
Mark attendance |
GET |
/api/attendance/ |
List attendance records (with filters) |
GET |
/api/attendance/today |
Get today's attendance for all employees |
GET |
/api/attendance/employee/{id} |
Get attendance for specific employee |
PUT |
/api/attendance/{id} |
Update attendance status |
DELETE |
/api/attendance/{id} |
Delete attendance record |
cd backend
# Activate virtual environment
source venv/bin/activate # macOS/Linux
venv\Scripts\activate # Windows
# Run all tests
pytest
# Run with coverage
pytest --cov=app --cov-report=html
# Run specific test file
pytest tests/test_routes_employees.py -v
# Run with markers
pytest -m unit
pytest -m integrationcd frontend
# Run unit tests
npm run test
# Run tests once (CI mode)
npm run test:run
# Run with coverage
npm run test:coverage
# Run E2E tests
npm run test:e2e
# Run E2E tests with UI
npm run test:e2e:uiThe project enforces minimum coverage thresholds:
- Lines: 70%
- Functions: 70%
- Branches: 60%
- Statements: 70%
-
Create PostgreSQL Database:
- Go to Render Dashboard → New → PostgreSQL
- Note the Internal Database URL
-
Create Web Service:
- Go to New → Web Service
- Connect your GitHub repository
- Configure:
- Root Directory:
backend - Build Command:
pip install -r requirements.txt - Start Command:
uvicorn app.main:app --host 0.0.0.0 --port $PORT
- Root Directory:
-
Set Environment Variables:
DATABASE_URL=<internal-postgres-url> CORS_ORIGINS=https://your-frontend.vercel.app
-
Import Project:
- Go to Vercel Dashboard → Import Project
- Connect your GitHub repository
-
Configure:
- Root Directory:
frontend - Framework Preset: Vite
- Root Directory:
-
Set Environment Variables:
VITE_API_URL=https://your-backend.onrender.com
hrms-lite/
├── backend/
│ ├── app/
│ │ ├── __init__.py
│ │ ├── main.py # FastAPI application entry point
│ │ ├── database.py # Database configuration
│ │ ├── enums.py # Enum definitions (AttendanceStatus)
│ │ ├── models/ # SQLAlchemy ORM models
│ │ │ ├── __init__.py
│ │ │ ├── employee.py # Employee model
│ │ │ └── attendance.py # Attendance model
│ │ ├── routes/ # API route handlers
│ │ │ ├── __init__.py
│ │ │ ├── employees.py # Employee endpoints
│ │ │ └── attendance.py # Attendance endpoints
│ │ └── schemas/ # Pydantic schemas
│ │ ├── __init__.py
│ │ ├── employee.py # Employee DTOs
│ │ └── attendance.py # Attendance DTOs
│ ├── tests/ # Test suite
│ │ ├── conftest.py # Pytest fixtures
│ │ ├── factories.py # Factory Boy factories
│ │ └── test_*.py # Test modules
│ ├── requirements.txt # Python dependencies
│ ├── pytest.ini # Pytest configuration
│ └── .env.example # Environment template
│
├── frontend/
│ ├── src/
│ │ ├── App.jsx # Root component
│ │ ├── main.jsx # Application entry
│ │ ├── index.css # Global styles
│ │ ├── components/ # Reusable components
│ │ │ ├── Alerts.jsx # Alert notification system
│ │ │ ├── BottomNav.jsx # Mobile navigation
│ │ │ ├── EmptyState.jsx # Empty state placeholder
│ │ │ ├── Modal.jsx # Modal dialog
│ │ │ ├── Navbar.jsx # Top navigation
│ │ │ └── Spinner.jsx # Loading spinner
│ │ ├── context/ # React context providers
│ │ │ └── AlertContext.jsx # Alert state management
│ │ ├── pages/ # Page components
│ │ │ ├── Dashboard.jsx # Dashboard page
│ │ │ ├── Employees.jsx # Employee management
│ │ │ └── Attendance.jsx # Attendance management
│ │ ├── services/ # API service layer
│ │ │ └── api.js # Axios configuration
│ │ └── tests/ # Frontend tests
│ ├── e2e/ # Playwright E2E tests
│ ├── package.json # NPM configuration
│ ├── vite.config.js # Vite configuration
│ └── vitest.config.js # Vitest configuration
│
├── .github/
│ └── workflows/
│ └── test.yml # CI/CD pipeline
│
├── README.md # This file
├── ARCHITECTURE.md # Architecture documentation
├── API.md # API reference
├── CONTRIBUTING.md # Contribution guidelines
└── CHANGELOG.md # Version history
We welcome contributions! Please see CONTRIBUTING.md for:
- Development environment setup
- Code style guidelines
- Commit message conventions
- Pull request process
- Testing requirements
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with FastAPI - modern, fast web framework for Python
- UI powered by React and Vite
- Charts by Recharts
- Icons from React Icons
Built with ❤️ for modern HR management