src
├── api
│   └── <name>
│       ├── controllers
│       │   └── <name>.controller.ts
│       ├── services
│       │   └── <name>.service.ts
│       └── <name>.module.ts
├── dto
│   └── <name>
│       ├── base.<name>.dto.ts
│       ├── create.<name>.dto.ts
│       └── update.<name>.dto.ts
├── globals
│   ├── enums
│   │   └── <name>.enum.ts
│   ├── helpers
│   │   └── <name>.helper.ts
│   ├── interfaces
│   │   └── <name>.interface.ts
│   └── services
│       └── <name>.service.ts
├── guards
│   └── <name>.guard.ts
├── interceptors
│   └── <name>.interceptor.ts
└── schemas
    └── <name>
        └── <name>.schema.ts

Folder Structure and File Naming

Maintaining a well-organized folder structure and adhering to a consistent file naming convention is crucial for keeping the project navigable and comprehensible to all team members. Please abide by the predetermined folder structure to ensure a uniform understanding across the board.

The Rationale Behind Our Structure:

  • API Folder: The api folder houses all the endpoints, including their corresponding controllers and services. In certain scenarios, subdividing the api folder further is sensible. For instance, if there’s an app and a dashboard each accessing different endpoints or having distinct logic, creating separate controllers and services for each is prudent to retain clarity. For example, a dashboard folder for all dashboard endpoints and an app folder for all app endpoints.
  • Schemas Folder: Schemas are universal across all endpoints, hence they are not nestled within the api folder alongside controllers and services. Instead, they reside at the root src level within a schemas folder.
  • Globals Folder: The globals folder is designated for global functions, services, and variables, all neatly organized into sub-folders.
  • DTOs Folder: DTOs (Data Transfer Objects) also have their own haven at the src root level in a dedicated dtos folder, where each schema’s DTOs are defined.
This organizational ethos extends to other folders not elucidated here. They are structured thematically, making it easier to locate related files. The folder name should reflect the theme, e.g., guards, dtos, etc. For the specifics on how files within these folders should be named, refer to the Naming Conventions section.