NestJs Clean Arquitecture
Mutation test - stiker This is an example of using DDD with nestjs, only for proof of concept and framework study If you want more documentation of it, click here Nest
A quick introduction to clean architecture
Branch Definitions
- master: Flat structure with mongo connection
- flat-structure-sql: Flat structure with connection to sqlite can be easily changed to any connection that allows sequelizejs
- hexagonal-architecture: Exagonal structure with mongo connection
Getting Started
git clone [email protected]:ecaminero/nestjs-ddd.git
Structure
.
âââ doc
â  âââ *.http
âââ src
â  âââ app
â  â  âââ __test__
â  â  â  âââ *.controller.spec.ts
â  â  âââ controller
â  â  â  âââ *.controller.ts
â  â  âââ dto
â  â  â  âââ *.dto.ts
â  â  âââ interceptors
â  â  â  âââ *.interceptor.ts
â  â  âââ middlewere
â  â  âââ *.middleware.ts
â  âââ domain
â  â  âââ __test__
â  â  â  âââ *.service.spec.ts
â  â  âââ entities
â  â  â  âââ *.entity.ts
â  â  âââ service
â  â  âââ *.service.ts
â  âââ infrastructure
â  â  âââ database
â  â  â  âââ *.providers.ts
â  â  âââ health
â  â  â  âââ *.check.ts
â  â  âââ model
â  â  â  âââ *.model.ts
â  â  âââ repository
â  â  âââ *.repository.ts
â  âââ main.ts
â  âââ app.module.ts
â  âââ constants.ts
âââ test
â  âââ app.e2e-spec.ts
â  âââ jest-e2e.json
âââ jest.config.json
âââ localhost.sqlite
âââ nest-cli.json
âââ nodemon-debug.json
âââ nodemon.json
âââ package-lock.json
âââ package.json
âââ README.md
âââ tsconfig.build.json
âââ tsconfig.json
âââ tslint.json
Prerequisites
- node 10+
- mongo DB
- Sqlite
$ docker run --name dev-mongo -p 27017:27017 -d mongo
Installing
$ npm install
If you see this everything all fine
added 898 packages from 578 contributors and audited 876746 packages in 11.087s
found 0 vulnerabilities
Running the tests
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# coverage
$ npm run test:cov
Built With
-
Nest - The framework used
-
Mongoosejs - elegant object modeling for Nodejs
-
node.js- Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine
-
jestjs Jest is a delightful JavaScript Testing Framework with a focus on simplicity
-
sequelizejs Sequelize is a promise-based Node.js ORM for Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server. It features solid transaction support, relations, eager and lazy loading, read replication and more.
Authors
- Edwin Caminero - Initial work - github
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Acknowledgments
- Inspiration
- Hexagonal architecture concept tests