How nguyengiahau0508/tdmu-dispatch-dev works
Project type and purpose
• This is a full-stack web application (“TDmu Document Workflow”) comprising:
• A NestJS GraphQL backend (“apps/backend”) exposing business functionality (auth, approval, dispatch, organizational, file management, user management).
• An Angular frontend SPA (“apps/frontend”) consuming the GraphQL API.
• Infrastructure defined via Docker, Docker Compose, and NGINX.
Main components
A. Client Layer
• Browser / Angular SPA
• Apollo Client / HTTP transport
B. Edge / Reverse Proxy
• NGINX (serves static assets, proxies GraphQL requests)
C. API Layer
• NestJS GraphQL Server
– Core Modules (Config, Database, GraphQL‐API)
– Feature Modules (Auth, Approval, Dispatch, Organizational, Files, Users)
– Integrations (Redis Cache, Google Drive, Google OAuth2, Mail)
D. Data Layer
• Primary Database (e.g., PostgreSQL or MySQL)
• Redis (caching / session store)
E. External Services
• Google Drive API
• Google OAuth2
• SMTP/Mail provider
Relationships and data flows
• Within NestJS:
• Resolvers invoke Services → Repositories → DB
• Services call Cache service → Redis
• Auth services leverage JWT Strategy → external OAuth2 (Google)
• File uploads/integration services call Google Drive API or Mail Service.
• Responses flow back along the same chain to the client.
Architectural patterns and design principles
• Modular Monolith: Distinct NestJS modules encapsulate domain features (each with its own DTOs, entities, services, resolvers).
• Layered Architecture:
• API Layer (GraphQL Resolvers)
• Service Layer (business logic)
• Data Access Layer (TypeORM entities & repositories)
• Configuration via @nestjs/config with schema validation.
• Use of Guards, Filters, Decorators for cross-cutting concerns (auth, roles, exception handling).