Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leip1493/poc-nestjs-ports-and-adapters
🚀 NestJS x Ports and adapters 🚀
https://github.com/leip1493/poc-nestjs-ports-and-adapters
clean-architecture clean-code hexagonal-architecture nestjs ports-and-adapters solid typescript
Last synced: 3 months ago
JSON representation
🚀 NestJS x Ports and adapters 🚀
- Host: GitHub
- URL: https://github.com/leip1493/poc-nestjs-ports-and-adapters
- Owner: leip1493
- Created: 2023-06-23T04:20:21.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-01-27T01:00:13.000Z (12 months ago)
- Last Synced: 2024-10-12T06:42:50.104Z (3 months ago)
- Topics: clean-architecture, clean-code, hexagonal-architecture, nestjs, ports-and-adapters, solid, typescript
- Language: TypeScript
- Homepage:
- Size: 555 KB
- Stars: 24
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
[circleci-url]: https://circleci.com/gh/nestjs/nest## Description
This repository serves as a proof of concept for implementing the Ports and Adapters (Hexagonal) architecture pattern using NestJS. The structure emphasizes a clear separation between application logic and external dependencies, promoting maintainability and testability.
## Installation
```bash
$ npm install
```## Running the app
Running Locally
- Using Docker
To run the NestJS application using Docker, follow these steps:Build the Docker image:
```bash
docker-compose build
```Start the application:
```bash
docker-compose build
```This will start the NestJS application and an SQLite database in separate containers.
Access the application at http://localhost:3000- Without Docker
If you prefer not to use Docker, you can run the application locally with the following command:```bash
# development
$ npm run start# watch mode
$ npm run start:dev# production mode
$ npm run start:prod
```## Folder structure
```
.
├── src
│ ├── user
│ │ ├── domain
│ │ │ ├── UserRepository.ts
│ │ │ └── User.ts
│ │ ├── application
│ │ │ ├── get-all-users/
│ │ │ └── user-creator
│ │ │ ├── UserCreator.ts
│ │ │ ├── UserCreatorRequest.ts
│ │ │ └── UserCreator.spec.ts
│ │ └── infrastructure
│ │ ├── dto
│ │ │ └── create-user.dto.ts
│ │ ├── persistence
│ │ │ └── typeorm
│ │ │ ├── TypeormUser.ts
│ │ │ └── TypeormUserRepository.ts
│ │ ├── user.controller.ts
│ │ ├── user.module.ts
│ │ └── user.service.ts
│ ├── shared
│ │ ├── domain
│ │ │ ├── exceptions/
│ │ │ └── value-objects/
│ │ │ ├── Uuid.ts
│ │ │ └── MongoId.ts
│ │ └── infrastructure
│ │ └── persistence
│ │ ├── typeorm/
│ │ ├── mongo/
│ │ └── redis/
│ └── main.ts
└── test
└── user
└── domain
├── UserMother.ts
└── UserEmailMother.ts
```## Test
```bash
# unit tests
$ npm run test# e2e tests
$ npm run test:e2e# test coverage
$ npm run test:cov
```## Support
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
## License
Nest is [MIT licensed](LICENSE).