finds.dev← search

// the find

Sairyss/domain-driven-hexagon

★ 14,705 · TypeScript · MIT · updated Jun 2024

Learn Domain-Driven Design, software architecture, design patterns, best practices. Code examples included

A reference implementation combining DDD, Hexagonal Architecture, Clean Architecture, and CQRS in NestJS/TypeScript. It's a learning resource first, a starter template second — the code is deliberately over-engineered to show patterns in isolation. Aimed at mid-to-senior developers who want to see these concepts wired together in one place before applying a fraction of them to real projects.

The layering is genuinely clean: domain objects know nothing about NestJS, ports are properly inverted, and the mapper pattern keeps persistence concerns out of entities. The README is unusually honest — it explicitly lists cons and warns you not to use all of this on a CRUD app. Value objects enforcing invariants at construction time (no invalid state ever exists) is the right approach and the examples show it clearly. The vertical slice structure inside modules (one folder per use case) scales better than the usual 'controllers/', 'services/', 'repositories/' top-level split.

Last commit was June 2024 and NestJS, TypeORM, and Slonik have all moved; there's no indication this tracks upstream. The wallet module is a thin demo that doesn't stress-test the aggregate boundaries — in a real system with money involved you'd immediately hit questions about concurrency and the examples don't answer them. There are two database access patterns in the same repo (Slonik raw SQL for queries, TypeORM-style for commands) without a clear explanation of why, which will confuse someone learning from this. The e2e test setup requires a live database but the docker-compose and setup docs are minimal enough that getting tests green locally takes real effort.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →