CodeVetter · Repo Unpack · Data flow
nestjs/nest
Decorator metadata enters module scanning and becomes container-owned instances and registered routes. HTTP requests pass through contextual guards, interceptors, and parameter pipes before reaching application methods. Application state can remain in a provider or move through a repository into an external database. Results return through framework response normalization and native adapter serialization.
- Module scanning merges reflected imports with dynamic-module imports, unwraps promises and forward references, and recursively scans dependencies.
- InstanceLoader creates prototypes first, then asynchronously creates module instances and records graph inspection data.
- Injector.loadInstance selects an instance by context and inquirer, detects pending dependency cycles, and combines constructor instantiation with property injection.
- RoutesResolver enumerates container controllers, combines prefix, module path, controller path, and version metadata, then delegates exploration.
- HTTP execution prepares contextual pipes, guards, and interceptors; its handler applies pipes before callback.apply(instance, args).
- For a metatype selected for DTO validation, ValidationPipe strips prototype keys, converts plain input to that metatype, validates it, and throws an exception generated from validation errors. Without a metatype or when toValidate() is false, it instead returns the input or applies primitive transformation.
- CatsService owns an in-memory Cat array; create appends to it and findAll resolves that same array.
- UsersService maps firstName and lastName into User and passes it to repository.save; reads and deletes use repository methods.
- Observable HTTP results are converted with lastValueFrom; ExpressAdapter serializes objects as JSON and other ordinary values as strings.
- StreamableFile wraps a buffer or existing Readable; ExpressAdapter applies stream headers, pipes to the response, and destroys unfinished streams when the response finishes.