--- description: NestJS API response format, feature modules, and Drizzle repository pattern globs: "**/*.ts" alwaysApply: false --- # Common Patterns ## API Response Format ```typescript interface ApiResponse { success: boolean data?: T error?: string meta?: { total: number page: number limit: number } } ``` ## Feature Module ```typescript @Module({ imports: [], controllers: [UsersController], providers: [UsersService, UsersRepository], exports: [UsersService], }) export class UsersModule {} ``` ## Repository Pattern (Drizzle) ```typescript interface Repository { findAll(filters?: Filters): Promise findById(id: string): Promise create(data: CreateDto): Promise update(id: string, data: UpdateDto): Promise delete(id: string): Promise } ``` ## Skeleton Projects When implementing new functionality: 1. Search for battle-tested NestJS module patterns 2. Use parallel agents to evaluate options: - Security assessment - Extensibility analysis - Relevance scoring - Implementation planning 3. Clone best match as foundation 4. Iterate within proven structure