Files
nest-base/.cursor/rules/nestjs-general-guidelines.mdc.mdc
2025-09-26 19:49:56 +07:00

26 lines
1.0 KiB
Plaintext

---
description: Specifies NestJS-specific architectural principles, modular design, and testing practices within the 'src' directory.
globs: src/**/*.*
---
- Use modular architecture
- Encapsulate the API in modules.
- One module per main domain/route.
- One controller for its route.
- And other controllers for secondary routes.
- A models folder with data types.
- DTOs validated with class-validator for inputs.
- Declare simple types for outputs.
- A services module with business logic and persistence.
- One service per entity.
- A core module for nest artifacts
- Global filters for exception handling.
- Global middlewares for request management.
- Guards for permission management.
- Interceptors for request management.
- A shared module for services shared between modules.
- Utilities
- Shared business logic
- Use the standard Jest framework for testing.
- Write tests for each controller and service.
- Write end to end tests for each api module.
- Add a admin/test method to each controller as a smoke test.