This project is a work-in-progress study aimed at implementing an API architecture using Domain-Driven Design (DDD) principles with Fastify and TypeScript.
The main goal of this project is to deepen the understanding and practical application of DDD concepts in Node.js backend development. Inspired by modern architecture patterns, the structure is designed to be scalable, maintainable, and oriented around the business domain.
Note: This project is under active development. Feedback and suggestions are welcome!
The codebase is organized according to DDD principles, separating responsibilities into distinct layers:
- Domain: Contains core business entities, value objects, and repository interfaces.
- Application: Encapsulates use cases and application services.
- Infra: Holds concrete implementations for repositories, controllers, database configuration, and integrations with external services.
- Interfaces: Deals with external communication, including DTOs, mappers, validators, and presentation-layer controllers.
src/
βββ domain/
βββ application/
βββ infra/
βββ interfaces/
- Node.js v20: JavaScript runtime.
- Fastify: High-performance Node.js web framework.
- TypeScript: Static typing for JavaScript.
- Commitlint: Linting for commit messages.
- ESLint: Static code analysis for code quality.
- Prettier: Code formatting.
- Husky: Git hooks for enforcing code standards.
- Node.js (v20 or higher)
- Yarn (package manager, installed globally)
Clone the repository:
git clone https://github.com/alvinscheibe/fastify-ddd.git
Navigate to the project directory:
cd fastify-ddd
Install dependencies:
yarn
To start the development server:
yarn dev
By default, the server will be available at http://localhost:3333
API documentation should be accessible at http://localhost:3333/docs if enabled.
This project is intended for educational purposes and does not have a specific license yet.