DA
danialzr/HR-NestJs
๐ Enterprise HRMS & ERP Backend built with NestJS & TypeORM. Features advanced RBAC, Session Management (Refresh Tokens), Hierarchical Organization, and Automated Attendance/Task tracking.
๐ Enterprise HR & Resources Planning (ERP) Backend
A sophisticated, modular backend architecture for Human Resources Management, built with NestJS and TypeORM. This system is engineered to handle complex organizational hierarchies, secure authentication flows, and real-time operational tracking.
๐ System Architecture & Key Modules
๐ Advanced Security & Auth (JWT + Refresh Tokens)
- Multi-Layered Auth: Secure Access & Refresh Token strategy.
- Session Audit: Refresh tokens track
userAgentandipAddressfor security monitoring. - Token Rotation: Automatic revocation of old tokens upon new session requests.
- Hashing: Industry-standard password hashing using
Bcrypt(12 rounds).
๐ฅ Organizational Hierarchy
- Self-Referencing Relations: Support for complex reporting lines (Manager-Employee hierarchy).
- Subordinate Isolation: Logic-level security ensuring managers can only access and manage their direct subordinates.
- Departmental Logic: Automated department assignment and active-member validation before deletion.
โฑ Attendance & Time Tracking
- Smart Check-In/Out: State-aware attendance system prevents overlapping sessions.
- Dual Calendar Support: Engineered for Persian (Jalali) dates (
jDate) alongside UTC timestamps. - History & Reporting: Advanced
QueryBuilderfor generating date-range reports.
๐ Task & Productivity Management
- Ownership Flow: Distinct separation between Task Creators and Assignees.
- Dynamic Status Updates: Role-based task management allowing employees to update progress and managers to oversee deadlines.
๐ Professional Infrastructure
- Standardized API Responses: A global
TransformResponseInterceptorensures all client-side communications follow a unified, predictable structure. - Custom Response Messaging: Integrated Farsi status messages for localized UX.
- Database Integrity: Strict
CASCADEandSET NULLpolicies using TypeORM decorators.
๐ Tech Stack
- Framework: NestJS
- Database: PostgreSQL (TypeORM)
- Security: Passport.js, JWT, Bcrypt
- Optimization: Eager/Lazy loading strategies for high-performance queries.
๐ Installation
- Clone & Install:
git clone [https://github.com/danialzr/HR-NestJs.git](https://github.com/danialzr/HR-NestJs.git) npm install
- Environment Configuration: Create a .env file with JWT_ACCESS_SECRET, JWT_REFRESH_SECRET, and DATABASE_URL.
- Database Migration: npx typeorm migration:run
- Launch: npm run start:dev
On this page
Languages
TypeScript99.1%JavaScript0.9%
Contributors
Created December 30, 2025
Updated February 27, 2026