NestJS Framework Support
LogicStamp Context provides comprehensive support for NestJS applications, automatically detecting controllers, routes, decorators, and extracting API signatures from your backend code.
NestJS Detection
LogicStamp automatically identifies NestJS code by:
- NestJS imports: Detects imports from
@nestjs/common,@nestjs/core, and other@nestjs/*packages - Controller decorators: Recognizes
@Controller()decorator on classes - Route decorators: Detects
@Get(),@Post(),@Put(),@Delete(),@Patch()decorators on methods - Class-based architecture: Identifies controller classes and their methods
Detection requires both: (1) NestJS import and (2) Controller or route decorators. This two-factor detection prevents false positives - files that import NestJS but don't define controllers won't be detected as backend files.
Controllers
NestJS controllers are automatically detected and analyzed:
// users.controller.ts
import { Controller, Get, Post, Body, Param } from '@nestjs/common';
@Controller('users')
export class UsersController {
@Get()
findAll() {
return [];
}
@Get(':id')
findOne(@Param('id') id: string) {
return { id };
}
@Post()
create(@Body() createUserDto: CreateUserDto) {
return { id: '123', ...createUserDto };
}
}Extracted information:
- Controller name:
UsersController - Base path:
users(from@Controller('users')) - Routes: All methods with HTTP decorators
- Route paths: Extracted from decorator arguments
- Route parameters: Extracted from path patterns (e.g.,
:id→['id'])
Route Methods
LogicStamp extracts routes from controller methods:
@Controller('users')
export class UsersController {
@Get() // Route: GET /users
findAll() { }
@Get(':id') // Route: GET /users/:id
findOne(@Param('id') id: string) { }
@Post() // Route: POST /users
create(@Body() dto: CreateUserDto) { }
@Put(':id') // Route: PUT /users/:id
update(@Param('id') id: string, @Body() dto: UpdateUserDto) { }
@Delete(':id') // Route: DELETE /users/:id
remove(@Param('id') id: string) { }
@Patch(':id') // Route: PATCH /users/:id
patch(@Param('id') id: string, @Body() dto: PatchUserDto) { }
}Extracted routes:
- HTTP methods: GET, POST, PUT, DELETE, PATCH
- Route paths: Combined base path + method path
- Handler names: Method names (
findAll,findOne, etc.) - Route parameters: Extracted from path patterns
API Signatures
LogicStamp extracts API signatures from controller methods:
@Controller('users')
export class UsersController {
@Get(':id')
findOne(@Param('id') id: string): Promise<User> {
// ...
}
@Post()
create(@Body() createUserDto: CreateUserDto): Promise<User> {
// ...
}
}Extracted API signature:
- Parameters:
{ id: string, createUserDto: CreateUserDto } - Return type:
Promise<User> - Request type:
CreateUserDto(for POST/PUT/PATCH) - Response type:
User
Component Kinds
LogicStamp categorizes NestJS files into different kinds:
node:apiNestJS controller files with route definitions
ts:moduleTypeScript modules/utilities (non-controller files)
Usage
Generate context for a NestJS project:
# Analyze NestJS project
stamp context
# The tool will automatically:
# 1. Detect NestJS imports and controller decorators
# 2. Extract controller classes and base paths
# 3. Extract route definitions (paths, methods, handlers)
# 4. Extract API signatures from controller methods
# 5. Identify route parameters
# 6. Extract decorators and annotations
# 7. Generate structured contracts for each controller fileLimitations
Services and Modules
NestJS services and modules are not extracted. LogicStamp focuses on extracting API routes and their signatures. Controllers define the API surface, while services and modules are implementation details.
Guards and Interceptors
Guards and interceptors are detected as decorators but their logic is not extracted. Decorators appear in languageSpecific.annotations, but guard/interceptor implementations are not analyzed.
Multiple Controllers
If multiple controllers exist in one file, only the first one is extracted. NestJS best practices recommend one controller per file, so this limitation aligns with common patterns.
Next Steps
Get started with LogicStamp Context or explore other backend framework integrations.