How hieu36075/dev-manager works
Main Components
• Frontline (Presentation) Layer: This is where HTTP endpoints and controllers are defined (e.g., src/presentation/*). These modules handle incoming requests (for auth, file operations, language, project, technical, etc.).
• Application Layer: Contains use-case implementations and data transfer objects (DTOs), segregating command and query responsibilities. It orchestrates business rules and validates inputs.
• Domain Layer: This layer defines the core business models/entities and includes the interfaces (repositories, adapters) that the application layer relies on. It encapsulates business rules and entities (e.g., language.model.ts, project.model.ts, user.model.ts).
• Infrastructures Layer: Provides the concrete implementation of repositories and services that interact with external systems (e.g., typeORM configuration, repositories for various entities, external integrations like Cloudinary, bcrypt, JWT, and docxtemplate services).
Relationships and Interactions
• The Presentation Layer (REST controllers) receives client requests and then calls into the Application Layer. Use controllers (e.g., auth.controller.ts, file.controller.ts) to show entry points.
• The Application Layer is composed of various use-case “commands” and “queries”. Each use-case typically delegates the heavy lifting to business logic and repository interfaces defined in the Domain Layer.
• The Domain Layer defines the core business models/entities and establishes repository contracts. These contracts are then implemented in the Infrastructure layer.
• The Infrastructures Layer implements technical details like database integrations (via TypeORM), external service interactions (Cloudinary for file uploads, JWT for authentication, Docxtemplater for document generation, etc.) and configuration settings.
• Additionally, several decorators, guards, and strategies (located under src/application/common) serve to enforce security and enrich functionality (e.g., JWT strategy, role-based access).
Important Architectural Patterns and Design Principles
• Layered (N-tier) Architecture: Clearly separating presentation, application, domain, and infrastructure concerns.
• Domain-Driven Design (DDD): Domain models, repositories, and use-cases are located in their dedicated layers, emphasizing business logic encapsulation.
• Dependency Injection and Inversion of Control: Common NestJS patterns used to inject dependencies (e.g., repository implementations, security strategies) across layers.
• Command and Query Responsibility Segregation (CQRS): Evident in separate command and query directories inside each use-case module.
• Modular Organization: Each major business capability (e.g., language, project, technical) is self-contained and follows similar internal structures (command, query, DTO).
Relevant Technologies, Frameworks, or Libraries
• NestJS Framework (TypeScript, controllers, modules, decorators, dependency injection)
• TypeORM (for database interactions, as seen in infrastructures/typeorm)
• JWT, bcrypt, and Cloudinary integrations for authentication, hashing, and media management
• Docxtemplater for document generation (with corresponding services and adapters)
• Testing frameworks (evident from e2e tests and Jest configuration)