/nestjs-starter-kit

A fundamental approach to start your NestJS application that is based on Hexagonal Architecture.

Primary LanguageTypeScriptMIT LicenseMIT

Nest Logo

NestJS Starter Kit is based on Hexagonal Architecture

Description

Nest framework TypeScript starter repository.

Features

  • Database. Support TypeORM.
  • Migration and Seeding.
  • Config Service (@nestjs/config).
  • Mailing (nodemailer).
  • Sign in and sign up via email.
  • Admin and User roles.
  • Internationalization/Translations (I18N) (nestjs-i18n).
  • Swagger.

Project setup

$ yarn install

Compile and run the project

# development
$ yarn run start

# watch mode
$ yarn dev

# production mode
$ yarn run start:prod

Hexagonal Architecture

Hexagonal Architecture Diagram

Description of the module structure

.
├── domain/
│   └── [DOMAIN].ts
├── dto/
│   ├── create.dto.ts
│   ├── update.dto.ts
│   └── get-all.dto.ts
├── infrastructure/
│   ├── entities/
│   │   └── [ENTITY].ts
│   ├── mappers/
│   │   └── [MAPPER].ts
│   └── repositories/
│       ├── [ADAPTER].repository.impl.ts
│       └── [PORT].repository.ts
├── controller.ts
├── module.ts
└── service.ts

[DOMAIN].ts represents an entity used in the business logic. Domain entity has no dependencies on the database or any other infrastructure.

[ENTITY].ts represents the database structure. It is used in the relational database.

[MAPPER].ts is a mapper that converts database entity to domain entity and vice versa.

[PORT].repository.ts is a repository port that defines the methods for interacting with the database.

[ADAPTER].repository.impl.ts is a repository that implements the [PORT].repository.ts. It is used to interact with the database.

License

Nest is MIT licensed.