A centralized backend API for a complete Human Resource Management System, built with FastAPI and PostgreSQL.
It provides secure authentication, employee management, attendance tracking, leave workflows, and automated payroll processing.
- Secure user login (/auth/login)
- Password hashing
- Role-based access (Admin, HR, Employee)
- Full CRUD operations
- Personal info + salary details
- Admin-controlled
- Clock-in / Clock-out system
- Duplicate prevention logic
- Attendance logs
- Leave request submission
- Admin/HR approval or rejection
- Leave history tracking
- Auto calculates base salary
- Deduction from approved leaves
- Generates net salary & payslip-ready data
- FastAPI (Python)
- PostgreSQL
- SQLAlchemy ORM
- Pydantic
- JWT (python-jose, passlib)
1️⃣ Clone the repository
git clone https://github.com/yrdaman/E_HRMS.git
cd E_HRMS
2️⃣ Create .env file
Create a .env file in the project root:
DATABASE_URL=postgresql://your_user:your_password@localhost/ehrms_db
JWT_SECRET_KEY=your_long_random_secret_key
3️⃣ Create the database
CREATE DATABASE ehrms_db;
4️⃣ Install dependencies
py -3.12 -m venv venv
./venv/Scripts/activate
pip install -r requirements.txt
5️⃣ (Optional) Seed dummy data
python app/seed.py
This creates:
- Dummy admin
- Dummy employee
- Sample employees
- Attendance history
- Leave requests
- Payroll entries
6️⃣ Run the server
uvicorn app.main:app --reload
API Docs:
👉 http://127.0.0.1:8000/docs
E_HRMS
│── .gitignore
│── readme.md
│── requirements.txt
│
└── app
│── main.py
│── __init__.py
│
├── auth
│ ├── dependencies.py
│ ├── models.py
│ ├── router.py
│ ├── schemas.py
│ ├── service.py
│ └── __init__.py
│
├── core
│ ├── config.py
│ ├── database.py
│ └── __init__.py
│
└── modules
├── attendance
│ ├── models.py
│ ├── router.py
│ ├── schemas.py
│ ├── service.py
│ └── __init__.py
│
├── employee
│ ├── models.py
│ ├── router.py
│ ├── schemas.py
│ ├── service.py
│ └── __init__.py
│
├── leave
│ ├── models.py
│ ├── router.py
│ ├── schemas.py
│ ├── service.py
│ └── __init__.py
│
└── payroll
├── models.py
├── router.py
├── schemas.py
├── service.py
└── __init__.py
| Module | Method(s) | Endpoint |
|---|---|---|
| Auth | POST | /auth/login |
| Employees | CRUD | /modules/employee |
| Attendance | GET/POST | /modules/attendance |
| Leave | GET/POST/PUT | /modules/leave |
| Payroll | POST | /modules/payroll/calculate |
📌 License: MIT License