finds.dev← search

// the find

bitloops/ddd-hexagonal-cqrs-es-eda

★ 1,422 · TypeScript · MIT · updated Nov 2025

Complete working example of using Domain Driven Design (DDD), Hexagonal Architecture, CQRS, Event Sourcing (ES), Event Driven Architecture (EDA), Behaviour Driven Development (BDD) using TypeScript and NestJS. Like what you see? Don't forget to star! ⭐ ^^^

A working NestJS reference implementation of DDD, hexagonal architecture, CQRS, event sourcing, and EDA on top of a todo app. It's deliberately over-engineered to demonstrate how these patterns fit together — the target audience is developers who've read the theory and want to see actual code before applying it to production systems.

The bounded-context structure is consistent and thorough: each module has its own application, domain, ports, contracts, and tests folders, and the separation actually holds rather than collapsing into a service-layer monolith. BDD-style use-case tests (in the `tests/__tests__` directories) test through the application layer against mock adapters, which means domain refactors don't break every test. Integration event versioning is present in the contracts layer — a detail most example repos skip and then regret later. The observability stack (Jaeger, Prometheus, Grafana, SSE for real-time client events) is wired up end-to-end, not just mentioned in the README.

The email service adapter is a mock (`mock-email.service.ts`) with no real implementation provided, so the marketing bounded context's most visible side effect doesn't actually work. NATS JetStream is used for the message bus, but there's no dead-letter or replay handling shown — if a handler fails, events disappear silently. gRPC is deprecated in favor of REST mid-project, leaving dead proto files and partial gRPC references that will confuse anyone trying to follow the architecture. The todo domain itself is too simple to reveal the hard edges of event sourcing — there's no example of aggregate snapshots, projection rebuilds, or handling schema evolution on past events, which are the problems that bite you in production ES systems.

View on GitHub → Homepage ↗

// 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 →