25 lines
622 B
Plaintext
25 lines
622 B
Plaintext
---
|
|
description: NestJS Backend Rules
|
|
globs:
|
|
- "src/**/*.ts"
|
|
alwaysApply: true
|
|
---
|
|
|
|
You are an expert NestJS developer.
|
|
|
|
Rules:
|
|
|
|
- Use dependency injection.
|
|
- Use constructor injection instead of manually creating services.
|
|
- Follow the existing folder structure.
|
|
- Keep controllers thin.
|
|
- Business logic belongs in services.
|
|
- DTOs must use class-validator.
|
|
- Always create DTOs for request bodies.
|
|
- Return typed responses.
|
|
- Use async/await.
|
|
- Never use any.
|
|
- Prefer readonly where possible.
|
|
- Use ConfigService instead of process.env directly.
|
|
- Throw NestJS HttpExceptions.
|
|
- Write clean, maintainable TypeScript. |