Skip to content

Mo14745646/SmartHR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🏒 OmniFlow SmartHR β€” Enterprise Multi-Tenant SaaS

SmartHR Banner .NET Angular PostgreSQL SignalR

A flagship Enterprise-Grade HR platform showcasing 5+ years of Senior Full-Stack Engineering.

Live Demo Β· Backend API Docs Β· Architecture


🎯 Project Overview

SmartHR Enterprise is a production-grade, Multi-Tenant SaaS Human Resource management system demonstrating advanced architectural patterns that separate Senior Engineers from mid-level developers:

Feature Technology Complexity
Multi-Tenancy EF Core Global Query Filters πŸ”΄ Expert
Real-time Sync ASP.NET Core SignalR πŸ”΄ Expert
Background Jobs Hangfire + PostgreSQL 🟠 Advanced
JWT Authentication Role-Based Access Control 🟠 Advanced
Cloud Database Neon PostgreSQL 🟑 Intermediate
Enterprise Frontend Angular 17 + RxJS Subjects 🟠 Advanced

πŸ— System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    FRONTEND (Angular 17)                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  AuthService β”‚  β”‚SignalRServiceβ”‚  β”‚  Dashboard   β”‚  β”‚
β”‚  β”‚  (JWT/Tenant)β”‚  β”‚  (WebSocket) β”‚  β”‚  Component   β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β”‚ HTTP / WebSocket
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 BACKEND (ASP.NET Core 9)                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  JWT Auth    β”‚  β”‚  SignalR Hub β”‚  β”‚   Hangfire   β”‚  β”‚
β”‚  β”‚  + RBAC      β”‚  β”‚ /attendance  β”‚  β”‚   Workers    β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚         EF Core + Multi-Tenant DbContext         β”‚   β”‚
β”‚  β”‚     Global Query Filter β†’ TenantId Isolation     β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Neon PostgreSQL (Cloud)                      β”‚
β”‚  Tables: Tenants | Users | Employees | AttendanceRecords β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Key Engineering Highlights

πŸ” Multi-Tenant Architecture

Every database query automatically scopes data to the current tenant using EF Core Global Query Filters β€” data leakage between organizations is impossible at the ORM layer.

// SmartHRDbContext.cs β€” Multi-Tenant Global Query Filters
modelBuilder.Entity<Employee>().HasQueryFilter(e => e.TenantId == CurrentTenantId);
modelBuilder.Entity<AttendanceRecord>().HasQueryFilter(e => e.TenantId == CurrentTenantId);

⚑ Real-Time Sync via SignalR

When an employee checks in, ALL connected manager dashboards update instantly via WebSockets β€” no page refresh, no polling.

// AttendanceHub.cs β€” Broadcasting real-time events
public async Task CheckInPulse(int employeeId, string time)
{
    await Clients.All.SendAsync("ReceiveCheckIn", employeeId, time);
}
// Angular SignalR subscription
this.signalR.attendanceUpdates.subscribe(update => {
  const emp = this.employees.find(e => e.id === update.employeeId);
  emp.status = 'Online'; // UI instantly reflects check-in
});

πŸ”„ Background Processing via Hangfire

Heavy operations like Mass Payroll Export are queued via Hangfire so the API never blocks:

// Hangfire processes jobs asynchronously in the background
builder.Services.AddHangfire(config => config
    .UsePostgreSqlStorage(c => c.UseNpgsqlConnection(connectionString)));

πŸ›  Tech Stack

Backend

ASP.NET Core 9.0       β†’ REST API Framework
Entity Framework Core  β†’ ORM + Migrations
Npgsql                 β†’ PostgreSQL Provider
SignalR                β†’ Real-time WebSockets
Hangfire               β†’ Background Job Processing
JWT Bearer             β†’ Authentication

Frontend

Angular 17             β†’ UI Framework
@microsoft/signalr     β†’ WebSocket Client
RxJS Subject           β†’ Live Event Stream
Glassmorphism CSS      β†’ Premium UI Design
Inter (Google Fonts)   β†’ Typography

Infrastructure

Neon PostgreSQL        β†’ Cloud Database
XAMPP / localhost      β†’ Local Development
Vercel                 β†’ Frontend Deployment (planned)
Render.com             β†’ Backend Deployment (planned)

πŸš€ Getting Started

Prerequisites

  • .NET 9 SDK
  • Node.js 18+
  • Angular CLI (npm install -g @angular/cli)

1. Clone the Repository

git clone https://github.com/Mo14745646/SmartHR.git
cd SmartHR

2. Start the Backend API

cd backend
# Update connection string in appsettings.json with your PostgreSQL credentials
dotnet run
# API runs on: http://localhost:5086
# Swagger UI: http://localhost:5086/swagger
# Hangfire Dashboard: http://localhost:5086/hangfire

3. Start the Frontend

cd ..  # back to SmartHR root
npm install
npx ng serve --port 4400
# App runs on: http://localhost:4400

4. Login

Username: muath
Password: muath123

πŸ“ Project Structure

SmartHR/
β”œβ”€β”€ src/
β”‚   └── app/
β”‚       β”œβ”€β”€ services/
β”‚       β”‚   β”œβ”€β”€ auth.service.ts       ← JWT + Tenant management
β”‚       β”‚   └── signalr.service.ts    ← Real-time WebSocket client
β”‚       β”œβ”€β”€ app.component.ts          ← Main dashboard logic
β”‚       β”œβ”€β”€ app.component.html        ← Enterprise UI template
β”‚       └── app.component.css         ← Glassmorphism styling
└── backend/
    β”œβ”€β”€ Program.cs                    ← API startup + DI configuration
    β”œβ”€β”€ appsettings.json              ← JWT + DB configuration
    β”œβ”€β”€ Data/
    β”‚   └── SmartHRDbContext.cs       ← Multi-tenant EF Core context
    β”œβ”€β”€ Models/
    β”‚   β”œβ”€β”€ Tenant.cs
    β”‚   β”œβ”€β”€ User.cs
    β”‚   β”œβ”€β”€ Employee.cs
    β”‚   └── AttendanceRecord.cs
    β”œβ”€β”€ Hubs/
    β”‚   └── AttendanceHub.cs          ← SignalR WebSocket hub
    └── Migrations/                   ← EF Core database migrations

πŸ”’ Security Features

  • JWT Bearer Authentication β€” All protected endpoints require valid tokens
  • Role-Based Access Control β€” Tenant Admins vs Managers vs Employees
  • CORS with Credentials β€” Properly configured for WebSocket connections
  • Tenant Data Isolation β€” Global Query Filters prevent cross-tenant access

πŸ‘€ Author

Muath Salem β€” Senior Full Stack Engineer
5+ Years building enterprise SaaS solutions with .NET, Angular, and PostgreSQL.

LinkedIn Portfolio


Built with ❀️ to demonstrate Enterprise-Grade Engineering Excellence

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors