Introduction
In this tutorial, you'll learn how to set up DugongJS within a NestJS application using TypeORM for persistence. We'll walk through a practical example: implementing a very simple bank account aggregate. Eventually, we'll also introduce Kafka as a message broker and see how to implement command query responsibility segregation (CQRS).
You can find the complete source code for this tutorial in the official GitHub repository.
The goal of the tutorial is to demonstrate how to:
- Set up a NestJS application with DugongJS.
- Use PostgreSQL and TypeORM with DugongJS adapters.
- Define aggregates, domain events, and commands.
- Set up a project structure with domain and application layers.
- Interacting with an event-sourced aggregate using the DugongJS CLI.
By the end, you'll have a working NestJS application with an event-sourced BankAccount
aggregate.
This tutorial assumes you're already familiar with NestJS fundamentals.
This tutorial focuses on modeling the domain layer and integrating it with the NestJS application layer using DugongJS. As such, it does not cover essential application concerns like input validation, authentication, or authorization — those are outside the scope of this tutorial. However, this is critical to implement in any actual production application!