How zuhairahmed0/admin-dashboard works
Admin Dashboard API is a NestJS backend for authentication, administrative user management, avatar/file handling, and activity logs. The main workflow is an authenticated administrator request: controllers invoke application use cases, which operate on domain repositories and persist through Prisma/PostgreSQL. Authentication also supports token refresh and logout; uploads validate files before processing. The README documents centralized response/error handling, pagination/filtering, soft deletion, security controls, and Swagger. Some implementation files were not sampled, so uncertain internal wiring is omitted or marked unverified.
Main entry points: app.module.ts Nest application · auth.controller.ts Auth endpoints · user.controller.ts User administration endpoints · upload.controller.ts Upload endpoints
Components 20
API entry and shared controls
- Nest application
src/app.module.ts - Global response and errors
src/shared - Prisma PostgreSQL access
src/database/database.service.ts
Authentication and security
- Auth endpoints
src/auth/presentation/controller/auth.controller.ts - Token and user auth flows
src/auth/application/use-cases - JWT guard and strategy
src/auth/infrastructure/auth - Token and hash providers
src/shared/security
User administration
- User administration endpoints
src/users/presentation/controllers/user.controller.ts - User management use cases
src/users/application/use-cases - User model and repository contract
src/users/domain - Prisma user repository
src/users/infrastructure/repositories/prisma-user.repository.ts
File management
- Upload endpoints
src/upload/presentation/controllers/upload.controller.ts - Upload and file listing
src/upload/application/use-cases - File storage provider
src/upload/infrastructure/providers/local-storage.provider.ts - Prisma file repository
src/upload/infrastructure/repositories/prisma-file.repository.ts
Activity logging
- Activity log endpoints
src/logs/presentation/controllers/logs.controller.ts - Log creation and retrieval
src/logs/application/use-cases - Event log listener
src/logs/application/listeners/log.listener.ts - Prisma log repository
src/logs/infrastructure/repositories/prisma-log.repository.ts
Other components
- API client
Connections 28
- API client → Auth endpoints: sends auth requests
src/auth/presentation/controller/auth.controller.ts - API client → User administration endpoints: sends admin requests
src/users/presentation/controllers/user.controller.ts - API client → Upload endpoints: sends file requests
src/upload/presentation/controllers/upload.controller.ts - Nest application → Global response and errors: registers globally
src/app.module.ts - Nest application → Auth endpoints: loads module
src/app.module.ts - Nest application → User administration endpoints: loads module
src/app.module.ts - Nest application → Upload endpoints: loads module
src/app.module.ts - Nest application → Activity log endpoints: loads module
src/app.module.ts - Auth endpoints → Token and user auth flows: invokes use cases
src/auth/presentation/controller/auth.controller.ts - Auth endpoints → JWT guard and strategy: guards protected routes
src/auth/presentation/controller/auth.controller.ts - Token and user auth flows → User model and repository contract: uses user repository
src/auth/application/use-cases/login.use-case.ts - Token and user auth flows → Token and hash providers: uses token and hash contracts
src/auth/application/use-cases/login.use-case.ts - User administration endpoints → User management use cases: invokes use cases
src/users/presentation/controllers/user.controller.ts - User administration endpoints → JWT guard and strategy: guards routes
src/users/presentation/controllers/user.controller.ts - User management use cases → User model and repository contract: uses repository contract
src/users/domain/interfaces/user.repository.ts - Prisma user repository → Prisma PostgreSQL access: queries database
src/users/infrastructure/repositories/prisma-user.repository.ts - Upload endpoints → Upload and file listing: invokes use cases
src/upload/presentation/controllers/upload.controller.ts - Upload endpoints → JWT guard and strategy: guards uploads
src/upload/presentation/controllers/upload.controller.ts - Upload and file listing → File storage provider: uses storage
- Upload and file listing → Prisma file repository: uses file repository
- Prisma file repository → Prisma PostgreSQL access: queries database
src/upload/infrastructure/repositories/prisma-file.repository.ts - User administration endpoints → Event log listener: emits activity event
src/users/presentation/controllers/user.controller.ts - Auth endpoints → Event log listener: emits activity event
src/auth/presentation/controller/auth.controller.ts - Upload endpoints → Event log listener: emits activity event
src/upload/presentation/controllers/upload.controller.ts - Activity log endpoints → Log creation and retrieval: invokes retrieval
src/logs/presentation/controllers/logs.controller.ts - Event log listener → Log creation and retrieval: creates logs
- Log creation and retrieval → Prisma log repository: persists logs
src/logs/infrastructure/repositories/prisma-log.repository.ts - Prisma log repository → Prisma PostgreSQL access: queries database
src/logs/infrastructure/repositories/prisma-log.repository.ts