How mariyamnavila/emnex-backend works
EmNex is a multi-tenant workforce, project, and payroll API. Clients call the Express server; feature routes dispatch through controllers to services, which implement organization and employee administration, project/task work, submission review, payroll, and payments. Authentication and permission checks protect requests, while PostgreSQL/Prisma stores product state. The README documents service integrations and audit logging; sampled sources confirm controller-to-service calls and several authentication operations. Route wiring and unsampled service internals are represented only where documented, so uncertain feature-specific dependencies are omitted.
Main entry points: app.ts App Setup · prisma.ts PostgreSQL / Prisma · checkAuth.ts Auth & RBAC · auth.service.ts Auth Service
Components 24
API Runtime
- Express API
src/server.ts - App Setup
src/app.ts - Auth & RBAC
src/app/middleware/checkAuth.ts - Request Validation
src/app/middleware/validateRequest.ts - PostgreSQL / Prisma
src/app/lib/prisma.ts
Identity & Tenancy
- Authentication
src/app/module/auth/auth.route.ts - Auth Controller
src/app/module/auth/auth.controller.ts - Auth Service
src/app/module/auth/auth.service.ts - Organization
src/app/module/organization/organization.route.ts - Employee Lifecycle
src/app/module/employee/employee.route.ts - Departments
src/app/module/department/department.route.ts - Roles & Permissions
src/app/module/role/role.route.ts
Work Management
- Projects
src/app/module/project/project.route.ts - Tasks
src/app/module/task/task.route.ts - Work Submissions
src/app/module/submission/submission.route.ts
Payroll & Payments
Insights & Governance
- Analytics
src/app/module/analytics/analytics.route.ts - Audit Logs
src/app/module/audit-log/audit-log.route.ts - Audit Logger
src/app/utils/auditLog.ts
Other components
- API Client
- Stripe
- Google OAuth
- Cloudinary
Connections 47
- API Client → Express API: sends HTTPS
- Express API → App Setup: starts app
- App Setup → Authentication: mounts routes
- App Setup → Organization: mounts routes
- App Setup → Employee Lifecycle: mounts routes
- App Setup → Departments: mounts routes
- App Setup → Roles & Permissions: mounts routes
- App Setup → Projects: mounts routes
- App Setup → Tasks: mounts routes
- App Setup → Work Submissions: mounts routes
- App Setup → Payroll: mounts routes
- App Setup → Payments: mounts routes
- App Setup → Analytics: mounts routes
- App Setup → Audit Logs: mounts routes
- Authentication → Auth & RBAC: protects requests
- Authentication → Request Validation: validates input
- Authentication → Auth Controller: dispatches
- Auth Controller → Auth Service: calls
- Auth Service → PostgreSQL / Prisma: reads and writes
- Auth Service → Google OAuth: verifies identity
- Auth Service → Cloudinary: uploads avatars
- Auth Service → Audit Logger: records actions
- Organization → Auth & RBAC: protects requests
- Employee Lifecycle → Auth & RBAC: protects requests
- Departments → Auth & RBAC: protects requests
- Roles & Permissions → Auth & RBAC: protects requests
- Projects → Auth & RBAC: protects requests
- Tasks → Auth & RBAC: protects requests
- Work Submissions → Auth & RBAC: protects requests
- Payroll → Auth & RBAC: protects requests
- Payments → Auth & RBAC: protects requests
- Analytics → Auth & RBAC: protects requests
- Audit Logs → Auth & RBAC: protects requests
- Organization → PostgreSQL / Prisma: service persists data
- Employee Lifecycle → PostgreSQL / Prisma: service persists data
- Departments → PostgreSQL / Prisma: service persists data
- Roles & Permissions → PostgreSQL / Prisma: service persists data
- Projects → PostgreSQL / Prisma: service persists data
- Tasks → PostgreSQL / Prisma: service persists data
- Work Submissions → PostgreSQL / Prisma: service persists data
- Payroll → PostgreSQL / Prisma: service persists data
- Payments → PostgreSQL / Prisma: service persists data
- Payments → Stripe: creates checkout
- Stripe → Payments: sends webhook
- Analytics → PostgreSQL / Prisma: service queries metrics
- Audit Logs → PostgreSQL / Prisma: service queries logs
- Audit Logger → PostgreSQL / Prisma: writes audit events