nestjs-patterns

Solid

NestJS best practices, module architecture, DTOs, Guards, Interceptors, and common patterns. Use when building or reviewing NestJS backend services.

AI & Automation 30 stars 9 forks Updated 5 days ago MIT

Install

View on GitHub

Quality Score: 82/100

Stars 20%
50
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# NestJS Patterns ## Module Structure ``` src/modules/users/ ├── users.module.ts ├── users.controller.ts ├── users.service.ts ├── dto/ │ ├── create-user.dto.ts │ └── update-user.dto.ts ├── entities/ │ └── user.entity.ts └── guards/ └── user-owner.guard.ts ``` ## Key Patterns ### Module Definition ```typescript @Module({ imports: [PrismaModule], controllers: [UsersController], providers: [UsersService], exports: [UsersService], }) export class UsersModule {} ``` ### DTOs with Validation ```typescript import { IsEmail, IsString, MinLength } from 'class-validator' export class CreateUserDto { @IsEmail() email: string @IsString() @MinLength(8) password: string } ``` ### Service Pattern ```typescript @Injectable() export class UsersService { constructor(private readonly prisma: PrismaService) {} async create(dto: CreateUserDto) { return this.prisma.user.create({ data: dto }) } async findOne(id: string) { const user = await this.prisma.user.findUnique({ where: { id } }) if (!user) throw new NotFoundException() return user } } ``` ### Controller Pattern ```typescript @Controller('users') export class UsersController { constructor(private readonly usersService: UsersService) {} @Post() @HttpCode(HttpStatus.CREATED) create(@Body() dto: CreateUserDto) { return this.usersService.create(dto) } @Get(':id') @UseGuards(JwtAuthGuard) findOne(@Param('id') id: string) { return this.usersService.findO...

Details

Author
sabahattink
Repository
sabahattink/antigravity-fullstack-hq
Created
8 months ago
Last Updated
5 days ago
Language
PowerShell
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category