A full-stack Human Resources management solution designed to streamline employee administration, organizational department hierarchy, lookup classifications, vacation requests, and secure role-based authentication.
- Overview
- System Architecture
- Tech Stack
- Database Schema & Seed Data
- API Documentation & Endpoints
- Frontend Overview
- Project Directory Structure
- Getting Started & Local Setup
- Default Credentials
- License
The HR Management System provides organizations with a centralized platform to manage personnel records and organizational workflows. Key capabilities include:
- π Authentication & RBAC: JWT Bearer authentication with role claims (
Admin,HR,Manager,Developer) and BCrypt password encryption. - π₯ Employee Management: Comprehensive employee profiles (position, department, manager hierarchy, start/end dates, active status) with automated user account generation.
- π’ Department Tracking: Manage organizational departments, floor assignments, and department type classifications.
- ποΈ Vacation & Leave Tracking: Vacation request lifecycle, date range tracking, leave categorization, notes, and aggregated leave analytics per employee.
- π·οΈ Centralized Lookup System: Major/Minor code lookup dictionary for positions, department types, and leave types.
graph TD
Client["Angular 20 SPA (Client Browser)"]
API["ASP.NET Core 8 Web API"]
Auth["JWT Authentication & BCrypt Service"]
EF["Entity Framework Core 9"]
DB[("Microsoft SQL Server (Hr_System)")]
Client -->|HTTP / REST API Requests| API
Client -->|Bearer Token Header| Auth
API -->|Validate Token / Issue JWT| Auth
API -->|Queries & Commands| EF
EF -->|SQL Queries & Migrations| DB
- Framework: .NET 8 (ASP.NET Core Web API)
- ORM: Entity Framework Core 9 (Code-First)
- Database: Microsoft SQL Server
- Authentication: JWT Bearer Tokens (
Microsoft.AspNetCore.Authentication.JwtBearer) - Password Security:
BCrypt.Net-Next - API Documentation: Swagger / OpenAPI (
Swashbuckle.AspNetCore)
- Framework: Angular 20 (Standalone Components, Signals, Reactive Forms)
- Styling: Bootstrap 5.3.7 & Bootstrap Icons 1.13.1
- Build Tool: Angular CLI 20.1.5 with Vite-based builder
- Testing: Jasmine & Karma
erDiagram
LOOKUP {
bigint Id PK
int MajorCode
int MinorCode
string Name
}
USER {
bigint Id PK
string UserName UK
string HashedPassword
bit IsAdmin
}
DEPARTMENT {
bigint Id PK
string Name
string Description
int FloorNumber
bigint TypeId FK
}
EMPLOYEE {
bigint Id PK
string Name
datetime BirthDate
string Phone
bit IsActive
datetime StartDate
datetime EndDate
bigint DepartmentId FK
bigint ManagerId FK
bigint PositionId FK
bigint UserId FK,UK
}
VACATION {
bigint Id PK
bigint EmployeeId FK
datetime CreationDate
datetime StartDate
datetime EndDate
bigint TypeId FK
string Notes
}
LOOKUP ||--o{ DEPARTMENT : "categorizes (TypeId)"
LOOKUP ||--o{ EMPLOYEE : "defines position (PositionId)"
LOOKUP ||--o{ VACATION : "defines leave type (TypeId)"
DEPARTMENT ||--o{ EMPLOYEE : "employs (DepartmentId)"
EMPLOYEE ||--o{ EMPLOYEE : "manages (ManagerId)"
USER ||--|| EMPLOYEE : "authenticates (UserId)"
EMPLOYEE ||--o{ VACATION : "requests (EmployeeId)"
| Major Code | Category | Minor Code | Name |
|---|---|---|---|
0 |
Employee Positions | 0 |
Header (Employee Positions) |
0 |
Employee Positions | 1 |
HR |
0 |
Employee Positions | 2 |
Manager |
0 |
Employee Positions | 3 |
Developer |
1 |
Department Types | 0 |
Header (Department Types) |
1 |
Department Types | 1 |
Finance |
1 |
Department Types | 2 |
Adminstrative |
1 |
Department Types | 3 |
Technical |
2 |
Vacation Types | 0 |
Header (Vacation Types) |
2 |
Vacation Types | 1 |
Annual Vacation |
2 |
Vacation Types | 2 |
Sick Vacation |
2 |
Vacation Types | 3 |
Unpaid Vacation |
Swagger UI is available during development at:
http://localhost:5160/swagger or https://localhost:7168/swagger
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
POST |
/api/Auth/Login |
Validates credentials and generates a signed JWT token with user claims & role | β No |
Login Request Body:
{
"userName": "Admin",
"password": "Admin@123"
}| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/api/Employees/GetAll |
Retrieves filtered employee records | π Yes (HR, Admin) |
GET |
/api/Employees/GetById?Id={id} |
Retrieves a single employee by ID | β No |
POST |
/api/Employees/Add |
Creates employee & automatically provisions user account ({Name}_HR) |
β No |
PUT |
/api/Employees/Update |
Updates employee details | β No |
DELETE |
/api/Employees/Delete?id={id} |
Deletes an employee record | β No |
Query Parameters for GetAll:
PositionId(long, optional)EmployeeName(string, optional)IsActive(bool, optional)
Create Employee Request Body:
{
"name": "Jane Doe",
"birthDate": "1995-04-12T00:00:00Z",
"phone": "+962791234567",
"isActive": true,
"startDate": "2025-01-01T00:00:00Z",
"endDate": null,
"departmentId": 1,
"managerId": null,
"positionId": 2
}Note: Creating an employee automatically generates a linked user account with username
<Name>_HRand default password<Name>@123.
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/api/Departments/GetAll |
Retrieves departments with optional filters | β No |
GET |
/api/Departments/GetById?Id={id} |
Retrieves single department details with lookup info | β No |
POST |
/api/Departments/Add |
Creates a new department | β No |
PUT |
/api/Departments/Update |
Modifies existing department info | β No |
DELETE |
/api/Departments/Delete?Id={id} |
Deletes a department | β No |
Create Department Request Body:
{
"name": "Information Technology",
"description": "Software development and infrastructure",
"floorNumber": 3,
"typeId": 8
}| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/api/Vacations/GetAll |
Retrieves vacation requests (filterable by EmployeeId & VacationTypeId) |
β No |
GET |
/api/Vacations/GetById?Id={id} |
Retrieves a vacation record by ID | β No |
POST |
/api/Vacations/Add |
Submits a new vacation request | β No |
PUT |
/api/Vacations/Update |
Updates vacation dates or details | β No |
DELETE |
/api/Vacations/Delete?Id={id} |
Deletes a vacation request | β No |
GET |
/api/Vacations/EmployeesVacationsCount |
Returns total vacation request counts grouped by employee | β No |
Create Vacation Request Body:
{
"employeeId": 1,
"startDate": "2025-08-01T00:00:00Z",
"endDate": "2025-08-07T00:00:00Z",
"typeId": 10,
"notes": "Annual family leave"
}The client-side application is built with Angular 20 Standalone Components and Bootstrap 5:
- Navigation Bar: Responsive navbar for navigating between Employees, Departments, and Vacations sections.
- Employee Management Screen (
EmployeesComponent):- Search & filter bar (by employee name, position, status).
- Data table displaying employee name, phone, formatted dates, position, department, manager, and active/inactive badges.
- Interactive Bootstrap modal for adding or editing employee records.
- Reactive form validation (
employeeForm).
- Custom Utilities:
RandomColorDirective([appRandomColor]): Assigns random vibrant background colors to elements.ReversePipe(reverse): Pipe for reversing text strings.
HR/
βββ HR.sln # Root Visual Studio Solution
βββ global.json # .NET SDK version configuration (8.0.413)
βββ README.md # Project documentation
β
βββ HR/ # Backend Web API (.NET 8)
β βββ Controllers/ # API Controller Endpoints
β β βββ AuthController.cs # Login & JWT token generator
β β βββ DepartmentsController.cs # Department CRUD operations
β β βββ EmployeesController.cs # Employee CRUD & User sync
β β βββ VacationsController.cs # Vacation CRUD & Analytics
β βββ DTOs/ # Data Transfer Objects
β β βββ Auth/ # Login DTOs
β β βββ Departments/ # Department Filter & Save DTOs
β β βββ Employees/ # Employee Filter & Save DTOs
β β βββ Vacations/ # Vacation Filter, Save & Count DTOs
β βββ Migrations/ # EF Core Database Migrations
β βββ Model/ # Domain Entities
β β βββ Department.cs
β β βββ Employee.cs
β β βββ Lookup.cs
β β βββ User.cs
β β βββ Vacation.cs
β βββ Properties/
β β βββ launchSettings.json # Port configurations (5160 / 7168)
β βββ HrDbContext.cs # EF Core DbContext with Seed Data
β βββ HR.csproj # Backend Project dependencies
β βββ Program.cs # API Middleware, JWT & DI Setup
β βββ appsettings.json # Database Connection String & Logging
β
βββ Frontend/ # Frontend SPA
βββ HR/ # Angular 20 Application
βββ src/
β βββ app/
β β βββ components/
β β β βββ employees/ # Employees management component
β β β βββ employees.ts
β β β βββ employees.html
β β β βββ employees.css
β β βββ directives/ # Custom Angular directives
β β β βββ random-color.ts
β β βββ pipes/ # Custom Angular pipes
β β β βββ reverse-pipe.ts
β β βββ app.ts # Main root standalone component
β β βββ app.html # Main navigation layout
β β βββ app.css
β β βββ app.config.ts # Application config & providers
β βββ index.html
β βββ main.ts
β βββ styles.css
βββ angular.json # Angular CLI configuration
βββ package.json # Frontend dependencies & scripts
βββ tsconfig.json # TypeScript compiler configuration
Make sure you have the following installed on your machine:
- .NET 8.0 SDK
- Node.js (v18 or v20 LTS recommended)
- npm (v9+)
- Microsoft SQL Server (or LocalDB / SQL Express / Docker container)
- Angular CLI (optional,
npm install -g @angular/cli)
-
Navigate to the Backend directory:
cd HR -
Configure Database Connection String: Open
appsettings.jsonand adjust theHrContextconnection string to match your SQL Server instance:{ "ConnectionStrings": { "HrContext": "Server=localhost;Database=Hr_System;Trusted_Connection=True;MultipleActiveResultSets=true;TrustServerCertificate=True;" } } -
Apply Database Migrations & Seed Data: Ensure EF Core tools are installed, then apply the migrations:
dotnet tool install --global dotnet-ef # If not installed dotnet ef database update -
Run the Backend API:
dotnet run
The backend will start and listen at:
- HTTP:
http://localhost:5160 - HTTPS:
https://localhost:7168 - Swagger Documentation:
http://localhost:5160/swagger
- HTTP:
-
Navigate to the Frontend project directory:
cd Frontend/HR -
Install Dependencies:
npm install
-
Start the Development Server:
npm start # or: ng serve -
Access the Application: Open your browser and navigate to:
http://localhost:4200/
The database migration pre-seeds a default administrator account:
| Username | Password | Role | Description |
|---|---|---|---|
Admin |
Admin@123 |
Admin |
Full administrative privileges |
β οΈ When new employees are added through/api/Employees/Add, corresponding user accounts are automatically created with:
- Username:
<EmployeeName>_HR(e.g.John_HR)- Password:
<EmployeeName>@123(e.g.John@123)
This project is developed for internal Human Resources and personnel management operations.