Implementing DDD, CQRS and Event Sourcing (The Book + Code)
Implementing DDD, CQRS and Event Sourcing
About the Book
This book explains and illustrates how to implement Domain-Driven Design, Command Query Responsibility Segregation and Event Sourcing. The goal is to build software that is behavior-rich, event-based, problem-centric, reactive, scalable and well-designed. Domain-Driven Design is a way to build software that focuses on the problem to solve and its associated knowledge areas. Command Query Responsibility Segregation separates a software into a write side and a read side. Event Sourcing is an architectural pattern that represents state as a sequence of immutable events. The concepts are explained in theory and put into practice with standalone examples and a Sample Application. This is done without third-party software. The book comes with a source code bundle and supports interactive execution. All code is written in JavaScript and uses Node.js as runtime.
Style of this book
The primary focus of this book is the application and the implementation of concepts. Therefore, the purely theoretical parts are generally concise. The covered topics are illustrated extensively with a large amount of examples and code. Selected conceptual parts are also discussed in greater detail. Apart from Node.js and JavaScript, the book's main content does not utilize or explain specific frameworks or technologies. For functionalities that require persistence or inter-process communication, exemplary implementations are provided that directly work with the filesystem. This includes Repositories, the Event Store, Read Model stores and a remote event distribution. The goal is to convey a deeper understanding of the according concepts. For production purposes, these implementations can be replaced with suitable technologies. This procedure is exemplified in Appendix B.
The following articles explain selected aspects of the book style in more detail:
Packages
The Book + Code
Includes:
Code bundle (Release 1.3.3)
PDF
EPUB
WEB
English
Company Edition - 10 copies (50% discount)
Includes:
Code bundle (Release 1.3.3)
PDF
EPUB
WEB
English
Table of Contents
-
Preface
- Version & Feedback
- Style of this book
- Executing the code
- About the author
- Formatting and highlighting
- Chapter summary
-
Chapter 1: Domains
- Technological and business domains
- Domain Experts
- Subdomains
- Identification of Subdomains
- Sample Application: Domains
-
Chapter 2: Domain Models
- Structure and components
- Ubiquitous Language
- Domain Modeling
- Model representations
- Sample Application: Domain Models
-
Chapter 3: Bounded Contexts
- Relation to Domains
- Model and context sizes
- Contexts and language
- Technological boundaries
- Context Maps
- Sample Application: Bounded Contexts
-
Chapter 4: Software Architecture
- Common software parts
- Layered Architecture
- Onion Architecture
- Approach for this book
- Sample Application: Software architecture
-
Chapter 5: Code quality
- Model binding
- Readability
- Behavior and state
- Dealing with dependencies
- Command-Query-Separation
-
Chapter 6: Value Objects, Entities and Services
- Value Objects
- Entities
- Domain Services
- Invariants
- Sample Application: Domain Model implementation
-
Chapter 7: Domain Events
- Relation to Event-driven Architecture
- Naming conventions
- Structure and content
- Distribution and processing
- Sample Application: Event-based integration
-
Chapter 8: Aggregates
- Transactions
- Structure and access
- Concurrency
- Design considerations
- Eventual Consistency
- Sample Application: Aggregates
-
Chapter 9: Repositories
- Domain Model emphasis
- Design and implementation
- Optimistic Concurrency
- Interaction with Domain Events
- Sample Application: Repositories and event publishing
-
Chapter 10: Application Services
- Service design
- Use case scenarios
- Transactions and Processes
- Cross-cutting concerns
- Authentication and Authorization
- Sample Application: Application Services
-
Chapter 11: Command Query Responsibility Segregation
- Architectural overview
- Write and Read Model
- Read Model synchronization
- Commands and Queries
- Command and Query Handlers
- Sample Application: CQRS
-
Chapter 12: Event Sourcing
- Architectural overview
- Event-sourced Write Model
- Event Store
- Read Model Projection
- Domain Event publishing
- Sample Application: Event Sourcing
-
Chapter 13: Separate executable programs
- Program layouts
- Context-level communication
- Remote use case execution
- Remote event distribution
- Sample Application: Separate executable programs
-
Chapter 14: User Interface
- HTTP file server
- Task-based UI
- Optimistic UI
- Reactive Read Models
- Components and composition
- Sample Application: User Interface
-
Conclusion
- Apply the useful parts
- The use of frameworks
-
Appendix A: Static types
- Value Objects, Entities and Services
- Events
- Event-sourced Write Model
- Dependency Inversion
- Commands and Queries
- Sample Application: TypeScript implementation
-
Appendix B: Going into production
- Identifier generation
- Containerization and Orchestration
- Event Store
- Read Model store
- Message Bus
- HTTP server
- Sample Application: Going into production
- Bibliography
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them