How ahanafintesher/prisma-postgresql-server works
WorkSphere EMS is a REST backend for the Super Admin Portal. An administrator calls the Express gateway, which mounts service routes across direct, API, and versioned prefixes; protected routes authenticate and authorize requests before domain handlers return management results. The API covers identity, tenant operations, billing, governance, support, and platform settings, backed by Prisma/PostgreSQL and optional hybrid Redis caching. Shared pagination and response utilities support domain handlers. The graph follows documented capabilities and indexed references; unsampled controller internals are not assumed to prove specific calls.
Main entry points: index.ts Route Mounts · prisma.ts Prisma Client · redis.ts Redis and Memory Cache · pagination.ts Pagination
Components 20
API Gateway
- Express App
src/app.ts - Route Mounts
src/routes/index.ts
Admin Domains
- Authentication
src/services/auth/auth.controller.ts - Company Lifecycle
src/services/companies/company.controller.ts - Dashboard Metrics
src/services/dashboard/dashboard.controller.ts - Plans and Subscriptions
src/services/subscriptions/subscription.controller.ts - Payments and Promotions
src/services/payments/payment.controller.ts - Support and Notices
src/services/support/support.controller.ts - Admin Accounts
src/services/admin-users/admin-users.controller.ts - Roles and Permissions
src/services/roles/roles.controller.ts - Audit Logs
src/services/audit/audit.controller.ts - Settings and Telemetry
src/services/settings/settings.controller.ts
Shared Runtime
- JWT and RBAC
src/middleware/auth.middleware.ts - Cache Middleware
src/middleware/cache.middleware.ts - Pagination
src/lib/pagination.ts - Response Envelopes
src/lib/response.ts
Persistence and Cache
- Prisma Client
src/lib/prisma.ts - PostgreSQL
prisma/schema.prisma - Redis and Memory Cache
src/lib/redis.ts
Other components
- Super Admin
Connections 40
- Super Admin → Express App: sends requests
README.md - Express App → Route Mounts: mounts routes
src/app.ts - Express App → Settings and Telemetry: routes health checks
src/app.ts - Route Mounts → Authentication: mounts
src/routes/index.ts - Route Mounts → Company Lifecycle: mounts
src/routes/index.ts - Route Mounts → Dashboard Metrics: mounts
src/routes/index.ts - Route Mounts → Plans and Subscriptions: mounts
src/routes/index.ts - Route Mounts → Payments and Promotions: mounts
src/routes/index.ts - Route Mounts → Support and Notices: mounts
src/routes/index.ts - Route Mounts → Admin Accounts: mounts
src/routes/index.ts - Route Mounts → Roles and Permissions: mounts
src/routes/index.ts - Route Mounts → Audit Logs: mounts
src/routes/index.ts - Route Mounts → Settings and Telemetry: mounts
src/routes/index.ts - Route Mounts → JWT and RBAC: applies guards
src/routes/index.ts - Route Mounts → Cache Middleware: applies caching
src/routes/index.ts - JWT and RBAC → Prisma Client: checks admin role
src/middleware/auth.middleware.ts - Cache Middleware → Redis and Memory Cache: reads and writes
src/middleware/cache.middleware.ts - Company Lifecycle → Pagination: uses pagination
src/services/companies/company.controller.ts - Plans and Subscriptions → Pagination: uses pagination
src/services/subscriptions/subscription.controller.ts - Payments and Promotions → Pagination: uses pagination
src/services/payments/payment.controller.ts - Support and Notices → Pagination: uses pagination
src/services/support/support.controller.ts - Pagination → Response Envelopes: builds envelopes
src/lib/pagination.ts - Plans and Subscriptions → Redis and Memory Cache: invalidates categories
src/services/subscriptions/subscription.controller.ts - Payments and Promotions → Redis and Memory Cache: invalidates categories
src/services/payments/payment.controller.ts - Support and Notices → Redis and Memory Cache: invalidates categories
src/services/support/support.controller.ts - Settings and Telemetry → Redis and Memory Cache: reads health
src/services/settings/settings.controller.ts - Express App → Redis and Memory Cache: checks health
src/app.ts - Prisma Client → PostgreSQL: queries
src/lib/prisma.ts - Company Lifecycle → Prisma Client: uses client
src/services/companies/company.controller.ts - Dashboard Metrics → Prisma Client: uses client
src/services/dashboard/dashboard.controller.ts - Plans and Subscriptions → Prisma Client: uses client
src/services/subscriptions/subscription.controller.ts - Payments and Promotions → Prisma Client: uses client
src/services/payments/payment.controller.ts - Support and Notices → Prisma Client: uses client
src/services/support/support.controller.ts - Admin Accounts → Prisma Client: uses client
src/services/admin-users/admin-users.controller.ts - Roles and Permissions → Prisma Client: uses client
src/services/roles/roles.controller.ts - Audit Logs → Prisma Client: uses client
src/services/audit/audit.controller.ts - Settings and Telemetry → Prisma Client: uses client
src/services/settings/settings.controller.ts - Authentication → Prisma Client: uses client
src/services/auth/auth.controller.ts - Company Lifecycle → Response Envelopes: formats results
src/services/companies/company.controller.ts - Authentication → Response Envelopes: formats results
src/services/auth/auth.controller.ts