The NestJS Patterns I Actually Reach For
Modules, providers, guards — the framework gives you a lot. Here's the small subset I keep returning to after twenty production apps.
NestJS gives you a generous toolbox. After a few years and a few dozen apps in production, I've ended up using a small subset of it most of the time — and the rest only when I really need it.
Modules-by-feature, not modules-by-layer. Every feature gets a folder, a controller, a service, a few DTOs, and a handful of tests. No 'controllers/', no 'services/' — those structures don't survive past about ten features.
Guards for auth, interceptors for logging, pipes for validation. That's the trinity. Custom decorators only when there's an obvious win, and never for the sake of cleverness.
And one rule that's saved me more times than I can count: services don't talk to other services across feature boundaries. They go through events.