Development Server
Start the application in watch mode for automatic reloading on file changes:3001 by default. The application uses SWC as the TypeScript compiler for faster builds.
Docker Compose Environment
The project includes a full Docker Compose setup for local development:Services
| Service | Port | Description |
|---|---|---|
| App | 30011 | NestJS application |
| PostgreSQL | 54321 | Primary database |
| Redis | 63791 | Cache and sessions |
| Elasticsearch | 9200 | Customer search |
| Migrator | - | Runs DB migrations on startup |
Testing
The project uses Jest with ts-jest for testing.Test Utilities
- jest-mock-extended for type-safe mocking
- jest-when for conditional mock returns
- supertest for HTTP integration testing
- MockDate for time-dependent tests
Test Structure
Tests live in__test__ directories adjacent to source files:
Debugging
VS Code Debugger
Start the application in debug mode:9229. Attach VS Code using the Node.js debugger.
Logging
The application uses Pino (vianestjs-pino) for structured logging.
| Variable | Options | Default |
|---|---|---|
LOG_LEVEL | trace, debug, info, warn, error | debug |
LOG_PRETTY | true, false | true |
USE_NEST_LOGGER | true, false | false |
Database Migrations
Create a new migration
Run migrations
Revert last migration
Code Style
- TypeScript strict mode
- NestJS conventions (modules, controllers, services, guards)
- Use Case pattern for business logic
- Class-validator for DTO validation
- Zod for runtime schema validation