The NestJS stuff teams still skip:
- Standard Schema (Zod etc.) on @Body/@Query (v12)
- @nestjs/observe for framework-aware traces
- Dynamic modules + custom providers
- Reflector + custom metadata decorators
- Fastify adapter for lower latency
- BullMQ + CacheInterceptor
- Hybrid HTTP + microservice apps
- Vitest + oxlint defaults on new ESM projects
Ship one of these this week. Stop writing everything in the controller.
#NestJS #WebDev
NestJS 12: Standard Schema validation on route decorators.
@Post()
create(@Body({ schema: createUserSchema }) body: CreateUser) {
return this.users.create(body)
}
Zod, Valibot, ArkType work directly once the pipe is registered. class-validator still fine; this removes the wrapper packages.
#NestJS #WebDev
Queues with BullMQ keep heavy work off the request.
@Processor('emails')
export class EmailProcessor {
@Process('welcome')
async handle(job: Job) {
await this.mailer.send(job.data)
}
}
Inject the queue and add jobs from a service. Workers run in the same process or separate.
#NestJS #WebDev
Custom parameter decorators extract what you need.
export const User = createParamDecorator(
(data: unknown, ctx: ExecutionContext) => {
return ctx.switchToHttp().getRequest().user
}
)
@Get()
me(@User() user: UserEntity) {
return user
}
Stops repeating req.user extraction. Pair with a guard that attaches the user.
#NestJS #WebDev
Queues with BullMQ keep heavy work off the request.
@Processor('emails')
export class EmailProcessor {
@Process('welcome')
async handle(job: Job) {
await this.mailer.send(job.data)
}
}
Inject the queue and add jobs from a service. Workers run in the same process or separate.
#NestJS #WebDev
Exception filters turn errors into HTTP responses.
@Catch(HttpException)
export class HttpExceptionFilter implements ExceptionFilter {
catch(exception: HttpException, host: ArgumentsHost) {
const ctx = host.switchToHttp()
const res = ctx.getResponse()
res.status(exception.getStatus()).json(exception.getResponse())
}
}
Global or per-route. Keep domain errors mapped consistently.
#NestJS #WebDev
Man @StarWarsOutlaws is the game I didn't know I needed my whole life. Its like Fallout in space with all the weird Star Wars aliens you know and love.
This is my life now 😂 10/10
I'm a thieving, double crossing, space pirate with a bounty on my head 😎
Interceptors wrap the method call.
@Injectable()
export class LoggingInterceptor implements NestInterceptor {
intercept(ctx: ExecutionContext, next: CallHandler) {
const now = Date.now()
return next.handle().pipe(
tap(() => console.log(`done in ${Date.now() - now}ms`))
)
}
}
Use for logging, caching, response mapping. RxJS operators give you the result stream.
#NestJS #WebDev
Testing is first-class.
const module = await Test.createTestingModule({
controllers: [UsersController],
providers: [{ provide: UsersService, useValue: mockService }],
}).compile()
const app = module.createNestApplication()
await app.init()
Override providers with mocks. Supertest for HTTP. Vitest is the new default in Nest 12 ESM projects.
#NestJS #WebDev
Guards decide if a request may continue.
@Injectable()
export class AuthGuard implements CanActivate {
canActivate(ctx: ExecutionContext): boolean {
const req = ctx.switchToHttp().getRequest()
return !!req.user
}
}
@UseGuards(AuthGuard) on routes or controllers. Reflector reads metadata for role checks.
#NestJS #WebDev
Services hold the business logic. Controllers stay thin.
@Injectable()
export class UsersService {
constructor(private readonly db: DatabaseService) {}
async findOne(id: string) {
return this.db.user.find(id)
}
}
@Inject the dependencies. No direct HTTP knowledge inside the service.
#NestJS #WebDev


















