A comprehensive Employee Management System built with ASP.NET Core 10.0, featuring dual authentication (Cookie-based MVC + JWT API), role-based authorization, leave management, attendance tracking, and analytics dashboard.
- 🔐 Dual Authentication: Cookie-based for web UI, JWT for API
- 👥 Role-Based Access Control: Admin, Manager, Employee roles
- 📊 Analytics Dashboard: Real-time statistics and insights
- 📅 Leave Management: Request, approve, and track employee leaves
- ⏰ Attendance Tracking: Check-in/out with automatic calculations
- 🏢 Department Management: Organize employees by departments
- 🌐 RESTful API: Complete JWT-secured API for integrations
- 🐳 Docker Ready: Multi-architecture support (AMD64, ARM64)
The fastest way to get started! No need to install .NET or PostgreSQL.
docker network create ems-netdocker run -d \
--name ems-postgres \
--network ems-net \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=ems \
-p 5432:5432 \
postgres:15docker run -d \
--name ems-api \
--network ems-net \
-p 8080:8080 \
-e ASPNETCORE_ENVIRONMENT=Development \
-e ConnectionStrings__DefaultConnection="Host=ems-postgres;Port=5432;Database=ems;Username=postgres;Password=postgres" \
sumdahl/employee-management-system:v1.0.5https://hub.docker.com/repository/docker/sumdahl/employee-management-system/generaldocker ps
ems-api 0.0.0.0:8080->8080/tcp
ems-postgres 0.0.0.0:5432->5432/tcphttp://localhost:8080docker stop ems-api ems-postgres
docker rm ems-api ems-postgres
docker network rm ems-net# Clone the repository (or download docker-compose.yml)
git clone https://github.com/sumdahl/ems.git
cd EmployeeManagementSystem
# Start the application and database
docker-compose up -d
# View logs
docker-compose logs -f web
# Stop the application
docker-compose downAccess the application at: http://localhost:8080
If you already have PostgreSQL running:
docker run -d \
--name ems-app \
-p 8080:8080 \
-e ConnectionStrings__DefaultConnection="Host=your-db-host;Database=ems;Username=postgres;Password=yourpassword" \
sumdahl/employee-management-system:latest- .NET 10.0 SDK
- PostgreSQL 16+
- Node.js 20+ (for Tailwind CSS)
# Clone the repository
git clone https://github.com/sumdahl/ems.git
cd EmployeeManagementSystem
# Restore dependencies
dotnet restore
npm install
# Update connection string in appsettings.json
# Then run the application
dotnet runAccess the application at: http://localhost:5054
✅ Docker Image Available: sumdahl/employee-management-system:latest
✅ Local Development: http://localhost:5054
✅ Docker Deployment: http://localhost:8080
Email: admin@ems.com
Password: Admin@123
Role: Admin
Email: manager@ems.com
Password: Manager@123
Role: Manager
Email: employee@ems.com
Password: Employee@123
Role: Employee
- Navigate to http://localhost:5054
- Login with admin credentials above
- View system statistics
- See total employees, departments, pending leaves, and today's attendance
- Click "Employees" in navigation
- View the 2 seeded employees (John Doe, Jane Smith)
- Click "Add Employee" to create a new employee
- Test search and filter functionality
- Click "Register User" button (Admin only)
- Create a new user account for testing different roles
- Logout and login as a regular employee
- Navigate to "Leave Requests" → "Request Leave"
- Submit a leave request
- Logout and login as admin/manager
- Approve or reject the leave request
- Login as an employee
- Navigate to "Attendance" → "Check In"
- Check in for the day
- Later, go back to Attendance list and check out
The system includes:
- 5 Departments: HR, Engineering, Sales, Finance, Operations
- 9 Job Roles: Various positions across departments
- 1 Admin User: admin@ems.com
- 2 Sample Employees: John Doe (Software Engineer), Jane Smith (HR Manager)
- Full system access
- Create/edit/delete employees
- Manage departments
- Register new users
- Approve/reject leaves
- View all attendance
- Create/edit employees
- Manage departments
- Approve/reject leaves
- View team attendance
- View own profile
- Submit leave requests
- Check-in/check-out
- View own records
- Backend: ASP.NET Core MVC (.NET 10.0)
- Database: PostgreSQL (database:
emsit's just name) - Frontend: Tailwind CSS (CDN)
- Authentication: ASP.NET Identity
- Port: http://localhost:5054
EmployeeManagementSystem/
├── Controllers/ # MVC Controllers
├── Models/ # Entity models
├── Views/ # Razor views
├── Data/ # DbContext and seeding
├── ViewModels/ # View models
└── wwwroot/ # Static files
- ✅ Role-based authentication and authorization
- ✅ Employee CRUD with search/filter
- ✅ Department management
- ✅ Leave request workflow with approval
- ✅ Attendance tracking with check-in/out
- ✅ Analytics dashboard
- ✅ Modern, responsive UI
- ✅ PostgreSQL database integration
Press Ctrl+C in the terminal where the application is running.
cd ~/dotnet_project/EmployeeManagementSystem
dotnet runcd %USERPROFILE%\dotnet_project\EmployeeManagementSystem
dotnet run
The application is available on Docker Hub:
- Repository: sumdahl/employee-management-system
- Latest:
docker pull sumdahl/employee-management-system:latest - Version 1.0.0:
docker pull sumdahl/employee-management-system:v1.0.0
AWS ECS/Fargate
# Use the Docker image directly
docker pull sumdahl/employee-management-system:latestAzure Container Instances
az container create \
--resource-group myResourceGroup \
--name ems-app \
--image sumdahl/employee-management-system:latest \
--ports 8080Google Cloud Run
gcloud run deploy ems-app \
--image sumdahl/employee-management-system:latest \
--platform managedDigitalOcean App Platform
- Use Docker Hub image:
sumdahl/employee-management-system:latest
ASPNETCORE_ENVIRONMENT=Production
ASPNETCORE_URLS=http://+:8080
ConnectionStrings__DefaultConnection=Host=db-host;Database=ems;Username=user;Password=passThe system includes a complete RESTful API with JWT authentication for building frontend applications, mobile apps, or third-party integrations.
curl -X POST http://localhost:5054/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "admin@ems.com",
"password": "Admin@123"
}'Response:
{
"success": true,
"message": "Login successful",
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "...",
"expiresIn": 3600,
"user": {
"id": "...",
"email": "admin@ems.com",
"fullName": "System Administrator",
"roles": ["Admin"]
}
}
}# Get all employees
curl -X GET http://localhost:5054/api/employees \
-H "Authorization: Bearer {YOUR_TOKEN}"
# Get current user info
curl -X GET http://localhost:5054/api/auth/me \
-H "Authorization: Bearer {YOUR_TOKEN}"
# Get attendance records
curl -X GET http://localhost:5054/api/attendance \
-H "Authorization: Bearer {YOUR_TOKEN}"POST /api/auth/login- Login with email/passwordGET /api/auth/me- Get current user informationPOST /api/auth/refresh- Refresh expired token
GET /api/employees- List all employees (with filtering)GET /api/employees/{id}- Get employee by IDPOST /api/employees- Create employee (Manager/Admin only)PUT /api/employees/{id}- Update employee (Manager/Admin only)DELETE /api/employees/{id}- Delete employee (Admin only)
GET /api/attendance- List attendance recordsPOST /api/attendance/checkin- Check inPOST /api/attendance/checkout/{id}- Check out
All API responses follow this consistent structure:
Success:
{
"success": true,
"message": "Operation successful",
"data": { ... },
"errors": []
}Error:
{
"success": false,
"message": "Error description",
"data": null,
"errors": ["Detailed error 1", "Detailed error 2"]
}- Access Token Lifetime: 60 minutes
- Refresh Token Lifetime: 7 days
- Algorithm: HMAC SHA256
- Claims: User ID, Email, Full Name, Role
-
Create Environment
- Variable:
baseUrl=http://localhost:5054 - Variable:
jwt_token= (auto-populated)
- Variable:
-
Login Request
POST {{baseUrl}}/api/auth/login Body: { "email": "admin@ems.com", "password": "Admin@123" } Tests Script: var jsonData = pm.response.json(); if (jsonData.success && jsonData.data.token) { pm.environment.set("jwt_token", jsonData.data.token); } -
Protected Requests
GET {{baseUrl}}/api/employees Authorization: Bearer {{jwt_token}}
- API Documentation - Complete API reference with all MVC endpoints
- JWT Implementation Guide - Detailed JWT authentication implementation
- Test Users Guide - Default user credentials for testing
- Framework: ASP.NET Core 10.0 MVC
- Language: C# 13
- Authentication: ASP.NET Identity + JWT Bearer
- Database: PostgreSQL 16
- ORM: Entity Framework Core
- UI Framework: Tailwind CSS (CDN)
- Template Engine: Razor Pages
- JavaScript: Vanilla JS
- Containerization: Docker (Multi-arch: AMD64, ARM64)
- CI/CD: Docker Hub
- Deployment: Docker Compose ready
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
Developed by Sumiran Dahal
Enjoy exploring the Employee Management System! 🎉