A scalable NestJS backend application built with TypeScript and following Domain-Driven Design (DDD) principles with a layered architecture.
This project follows a layered architecture pattern with clear separation of concerns:
src/
βββ config/ # Configuration & environment validation
βββ core/ # Logger, errors, utilities
βββ domain/ # Entities, value objects, ports/interfaces
βββ application/ # Services, use cases
βββ infrastructure/ # External services
βββ interfaces/ # Controllers, DTOs, presenters
βββ modules/ # Feature modules that bind everything
βββ test-utils/ # Testing utilities
- Domain-Driven Design: Business logic lives in the domain layer
- Clean Architecture: Dependencies point inward, framework-agnostic domain
- Separation of Concerns: Each layer has a specific responsibility
- Testability: Easy to mock and test each layer independently
- Node.js (v18 or higher)
- npm (v8 or higher)
-
Clone the repository
git clone https://github.com/Veridion-Id/Backend-Veridion.git cd Backend-Veridion -
Install dependencies
npm install
-
Environment setup
# Copy environment template cp .env.example .env # Edit .env with your configuration nano .env
-
Start the application
# Development mode npm run start:dev # Production mode npm run build npm run start:prod
| Script | Description |
|---|---|
npm run start |
Start the application |
npm run start:dev |
Start in development mode with hot reload |
npm run start:debug |
Start in debug mode |
npm run start:prod |
Start in production mode |
npm run build |
Build the application |
npm run test |
Run unit tests |
npm run test:watch |
Run tests in watch mode |
npm run test:cov |
Run tests with coverage |
npm run test:e2e |
Run end-to-end tests |
npm run lint |
Run ESLint |
npm run format |
Format code with Prettier |
- Framework: NestJS - Progressive Node.js framework
- Language: TypeScript - Strict mode enabled
- Backend Services: Firebase Admin SDK - Authentication and Firestore
- Documentation: Swagger/OpenAPI - Available at
/docs - Testing: Jest - Unit and E2E testing
- Code Quality: ESLint + Prettier
Application configuration and environment validation.
- Entities: Core business objects
- Value Objects: Immutable objects with no identity
- Ports: Interfaces for external dependencies
Business logic and use cases. This layer orchestrates domain objects.
External services implementation (databases, APIs, file systems).
- Controllers: HTTP request handlers
- DTOs: Data Transfer Objects for validation
- Presenters: Response formatting
Feature modules that wire together domain, application, infrastructure, and interface layers.
Create a .env file in the root directory:
# Application Configuration
PORT=3000
NODE_ENV=development
# Firebase Configuration
FIREBASE_PROJECT_ID=your-firebase-project-id
FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nYOUR_PRIVATE_KEY_HERE\n-----END PRIVATE KEY-----\n"
FIREBASE_CLIENT_EMAIL=your-service-account@your-project.iam.gserviceaccount.com
# Add your other configuration variables hereOnce the application is running, visit:
- Swagger UI:
http://localhost:3000/docs - Health Check:
http://localhost:3000/
npm run testnpm run test:e2enpm run test:covThe project follows consistent code style:
- Prettier: Single quotes, no semicolons, trailing commas
- ESLint: TypeScript-specific rules
- Conventional Commits: For commit messages
npm run formatnpm run lintnpm run build- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'feat: add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
We use Conventional Commits:
feat:New featuresfix:Bug fixesdocs:Documentation changesstyle:Code style changesrefactor:Code refactoringtest:Test additions or changeschore:Build process or auxiliary tool changes
This project is licensed under the ISC License - see the LICENSE file for details.
If you have any questions or need help:
- Check the Issues page
- Create a new issue with detailed information
- Contact the development team
Happy Coding! π