CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/nestjs-best-practices

NestJS patterns -- modules, DI, exception filters, validation pipes, guards, interceptors, testing, config

98

1.36x
Quality

89%

Does it follow best practices?

Impact

100%

1.36x

Average score across 12 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

Evaluation results

100%

10%

Notifications Service Refactor

Dependency injection and service separation

Criteria
Without context
With context

No new in service

100%

100%

Constructor injection in service

100%

100%

@Injectable on NotificationsService

100%

100%

@Injectable on SmsService

100%

100%

@Injectable on EmailService

100%

100%

Controller delegates to service

100%

100%

No Request/Response in service

100%

100%

Providers registered in module

100%

100%

Response envelope

0%

100%

No new in controller

100%

100%

100%

26%

Restaurant Order API

Criteria
Without context
With context

@ValidateNested present

100%

100%

@Type present

100%

100%

whitelist: true

100%

100%

transform: true

0%

100%

forbidNonWhitelisted: true

100%

100%

Global pipe in main.ts

100%

100%

POST response envelope

0%

100%

GET response envelope

0%

100%

Feature module structure

100%

100%

Constructor injection

100%

100%

@Injectable on service

100%

100%

100%

40%

User Service Refactoring with Tests

Criteria
Without context
With context

Response data envelope

0%

100%

Error envelope shape

0%

100%

console.error for unknown errors

0%

100%

ConfigModule isGlobal

100%

100%

No process.env in service

100%

100%

No new EmailService

100%

100%

Test.createTestingModule used

100%

100%

Dependencies mocked in tests

100%

100%

Global ValidationPipe

100%

100%

Global filter in main.ts

100%

100%

Catch-all filter decorator

0%

100%

DTO with class-validator

100%

100%

100%

24%

Product Catalog API Error Handling and Validation

Criteria
Without context
With context

@Catch() no args

100%

100%

HttpException error shape

0%

100%

Unknown error shape

0%

100%

console.error for unknown

100%

100%

Global filter in main.ts

100%

100%

Implements ExceptionFilter

100%

100%

HttpException status code

100%

100%

500 for unknown

100%

100%

Filter file location

100%

100%

ValidationPipe global

100%

100%

100%

34%

Shipment Tracking API

Criteria
Without context
With context

Error envelope shape

0%

100%

Response data envelope

0%

100%

console.error for unknown errors

0%

100%

Global ValidationPipe with whitelist and transform

100%

100%

Performance logging interceptor with tap

100%

100%

Interceptor logs method URL duration

100%

100%

Catch-all filter decorator

100%

100%

Global filter in main.ts

100%

100%

DTO with class-validator decorators

100%

100%

Feature module structure

100%

100%

Filter in common/filters

100%

100%

Evaluated
Agent
Claude Code
Model
Claude Sonnet 4.6

Table of Contents