This project is a robust TypeScript microservice implementation that adheres to Domain-Driven Design (DDD) principles and Clean Architecture. It provides a scalable and maintainable foundation for building complex business applications with a clear separation of concerns.
- Domain-Driven Design (DDD): Focuses on the core domain and domain logic.
- Clean Architecture: Ensures that business rules are independent of frameworks and databases.
- TypeScript: Leverages strong typing for improved developer experience and code quality.
- Modularity: Organized into distinct modules for easy scaling and maintenance.
- Dependency Injection: Uses InversifyJS for inversion of control.
- ORM Integration: Incorporates TypeORM for database operations.
- API Documentation: Automatic OpenAPI (Swagger) documentation generation.
- Code Documentation: TypeDoc for generating code documentation.
- Testing: Jest setup for unit and integration testing.
- Linting and Formatting: Ensures code quality and consistency.
- Continuous Integration: Includes scripts for semantic versioning and releases.
src/
├── config/ # Configuration files
├── infrastructure/ # Infrastructure layer (databases, external services)
├── modules/ # Feature modules (e.g., Customer)
│ └── Customer/ # Example module
│ ├── application/ # Application services and DTOs
│ ├── domain/ # Domain entities and interfaces
│ ├── infrastructure/ # Repository implementations
│ └── presentation/ # Controllers and routes
├── shared/ # Shared kernel (base classes, utilities)
└── util/ # Utility functions
-
Clone the repository:
git clone [repository-url] -
Install dependencies:
npm install -
Set up environment variables: Copy
.env.exampleto.envand fill in the required values. -
Run the development server:
npm run start:dev
npm run test: Run testsnpm run build:compile: Compile TypeScriptnpm run lint:check: Check for linting issuesnpm run lint:fix: Fix linting issuesnpm run start:dev: Start development servernpm run start:prod: Start production servernpm run docs:build: Generate API and code documentation
To generate API and Code documentation
npm run docs:build
When running the server, documentation is avilable at:
/docs/apifor API Docs./docs/typedocfor Code Docs
We welcome contributions to this project! Here's a quick overview of the process:
- Create a Feature Branch from
develop - Write Code and Commit following our commit message format
- Submit a Pull Request using our PR template
- Participate in Code Review
- Follow Coding Rules including testing and documentation
- Merge once approved
For a more detailed guide on each of these steps, including our commit message format, PR template, and coding rules, please read our full Contributing Guidelines. This document provides in-depth information on:
- Detailed branch naming conventions
- Comprehensive commit message guidelines
- Complete PR template and best practices
- Step-by-step code review process
- Extensive coding rules and best practices
We encourage all contributors, new and experienced, to review the full guidelines to ensure a smooth and effective collaboration process.
Ready to contribute? Great! Start by reading the CONTRIBUTING.md file, and feel free to reach out if you have any questions. We look forward to your contributions!
Please ensure your code adheres to the project's coding standards and includes appropriate tests.
This project follows Clean Architecture principles:
- Domain Layer: Contains enterprise-wide logic and types.
- Application Layer: Orchestrates the flow of data to and from the domain layer.
- Infrastructure Layer: Implements interfaces defined in the domain layer.
- Presentation Layer: Handles HTTP requests and responses.
The use of DDD concepts like Aggregates, Value Objects, and Domain Events ensures a rich domain model that accurately represents the business rules.
This project is licensed under the [LICENSE NAME] - see the LICENSE.md file for details.