The purpose of this repository is to create a ready-to-use project following Domain-Driven Design, Clean Architecture and Functional Programming best practices combined with some DevOps techniques such as Continuous Integration, Continuous Delivery and Quality Assurance.
The project is completely open source using the MIT license, feel free to contribute by opening a issue, a pull request or a discussion topic.
In the following chapters you will find a description of the main choices, technologies and techniques adopted.
NodeJS | TypeScript | NestJS | PostgreSQL | Mikro-ORM | Docker |
template
repository npm install
docker-compose up -d
.env
file with all required environment variables (check out .env.dist
example file) npm run schema:update
NestJS provides a modular architecture that allows the creation of loosely coupled and easily testable components.
Although this framework natively supports the development of microservice or event-driven architectures, they will not
be considered because the purpose of this project is just to create a simple, extensible and ready-to-use application.
For this reason, we are going to implement a Modular Monolith: an architectural pattern that structures the
application into independent modules or components with well-defined boundaries.
Example of a Modular Monolith Architecture.
In addition to simplicity and extensibility, a modular monolith allows us to start the development of the application as
a single repository and deployment unit, with distinct and clear boundaries between business contexts.
By this way, we can gradually refactor our architecture to a microservice architecture rather than implementing it from
the beginning.
In NestJS, applications typically consists of multiple modules, each serving a specific purpose or feature set.
A module is a class annotated with the @Module()
decorator, and it encapsulates a specific domain or feature of the
application. A module class define providers and inject them into other components leveraging Dependency Injection.
Different layers of the Clean Architecture.