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.
- 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).
- 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.
- 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.
- 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.
- 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.
- Framework: NestJS
- Database: PostgreSQL (TypeORM)
- Security: Passport.js, JWT, Bcrypt
- Optimization: Eager/Lazy loading strategies for high-performance queries.
- 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