How rizky-iqbal36/crud-api works
This NestJS CRUD API supports registration and login, authenticated user self-service, admin user management, health checks, and user seeding. The main request flow is HTTP client → controller → user service → repository → MongoDB; authentication services and request middleware support protected routes. The graph also shows application-wide response and exception handling. Source excerpts establish the controller, service, repository, and module wiring; seeding and MongoDB deployment details are based on README documentation, so some relationships are not shown at implementation level.
Main entry points: user.service.ts User workflows · admin.controller.ts Admin routes · app.module.ts App module · base.controller.ts Request validation
Components 21
HTTP API
- User routes
src/controllers/api/user.controller.ts - Admin routes
src/controllers/api/admin.controller.ts - Health check
src/controllers/health-check.controller.ts - Request validation
src/controllers/base.controller.ts - User schemas
src/schema/requestvalidators/user.schema.ts
Identity and Access
- Auth routes
src/authentication/controller/auth.controller.ts - Auth middleware
src/authentication/middleware/auth.middleware.ts - Admin guard
src/app/guard/admin.guard.ts - Token and passwords
src/authentication/service/auth.service.ts
User Domain
- User workflows
src/services/user.service.ts - User repository
src/repositories/user.repository.ts - User model
src/database/models/user.model.ts - User seeding
src/database/seeds - Seeder entry
resources/seeder.ts
Runtime and Data
- MongoDB
- App module
src/app.module.ts - HTTP bootstrap
src/main.ts - Application config
src/app/config/appConfig.ts - Response interceptor
src/app/utils/interceptor/response.interceptor.ts - Exception handling
src/app/exception/http-exception.filter.ts
Other components
- API client
Connections 23
- API client → Auth routes: registers or logs in
README.md - API client → User routes: requests user data
README.md - API client → Admin routes: manages users
README.md - API client → Health check: checks health
README.md - Auth routes → Request validation: validates input
src/authentication/controller/auth.controller.ts - User routes → Request validation: validates input
src/controllers/api/user.controller.ts - Admin routes → Request validation: validates input
src/controllers/api/admin.controller.ts - Request validation → User schemas: uses schemas
src/controllers/base.controller.ts - Auth routes → User workflows: calls workflows
src/authentication/controller/auth.controller.ts - User routes → User workflows: calls workflows
src/controllers/api/user.controller.ts - Admin routes → User workflows: calls workflows
src/controllers/api/admin.controller.ts - User workflows → User repository: queries users
src/services/user.service.ts - User workflows → Token and passwords: hashes and signs
src/services/user.service.ts - User repository → User model: uses model
src/repositories/user.repository.ts - User model → MongoDB: persists user data
README.md - App module → Auth middleware: registers middleware
src/app.module.ts - Admin routes → Admin guard: guards routes
src/controllers/api/admin.controller.ts - HTTP bootstrap → App module: starts application
src/main.ts - App module → Response interceptor: registers interceptor
src/app.module.ts - App module → Exception handling: registers filter
src/app.module.ts - HTTP bootstrap → Application config: reads port
src/main.ts - Seeder entry → User seeding: runs seeding
README.md - User seeding → MongoDB: seeds users
README.md