DEV Community


Posted on

Domain-Driven Hexagon: Guide on Domain-Driven Design, Hexagonal architecture, best practices (TypeScript and NestJS examples)

Few months ago I've created a repository to gather some architectural patterns and best practices I've been using for the last few years, both at work and for personal projects. At first It was a project for myself, but it grew and have reached a point that I can share it and hopefully more people can learn some useful practices from it.

Main emphasis of this project is to provide recommendations on how to design software applications. In this repository are presented some of the techniques, tools, best practices, architectural patterns and guidelines gathered from different sources.

Code examples are written using NodeJS, TypeScript, NestJS framework and Typeorm for the database access.

Though patterns and principles presented in this repository are framework/language agnostic, so above technologies can be easily replaced with any alternative. No matter what language or framework is used, any application can benefit from principles described in this repository.

This project's architecture is mainly based on:

  • Domain-Driven Design (DDD)
  • Hexagonal (Ports and Adapters) Architecture
  • Secure by Design
  • Clean Architecture
  • Onion Architecture
  • SOLID Principles
  • Software Design Patterns

And many other sources and best practices (links to additonal resources in every section).

Check out my repo to see full readme and code examples:

Discussion (3)

cekingx profile image
I Dewa Gede Dirga Yasa

Thank you for the great work

fiqrisr profile image
Fiqri Syah Redha


nans profile image
Nans Dumortier

Thank you for your work and for sharing this!