Implementing DDD, CQRS and Event Sourcing (The Book + Code)
$24.99
Minimum price
$24.99
Suggested price

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 concept that focuses on the problem space 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:

  • Share this book

  • Feedback

    You must own a copy of this Book to access the forums.

    Email the Author(s)

About the Author

Alex Lawrence
Alex Lawrence

I am a software developer with knowledge and experience in architecture, automation, backend, frontend, operations, teaching, technical leadership and testing. Since 2007, my professional focus lies on full-stack web development.

In most projects, I use JavaScript or TypeScript as language and Node.js as backend runtime. Wherever useful, I apply selected parts of DDD. The architectural patterns I am most interested in are Event-driven Architecture, CQRS and Event Sourcing. For the frontend, I professionally work with various libraries, such as React or lit-html. Personally, I favor to use native technologies, such as Web Components.

Most recently, I started with Rust and Kotlin as new programming languages and picked up selected concepts of Functional Programming. Since many years, I am a strong supporter for Free/Libre Open Source Software.

Packages

The Book + Code

Includes:

  • extras
    Code bundle (Release 1.3.3)
  • PDF

  • EPUB

  • MOBI

  • WEB

  • English

$24.99
Minimum price
$24.99
Suggested price
Company Edition - 10 copies (50% discount)

Includes:

  • extras
    Code bundle (Release 1.3.3)
  • PDF

  • EPUB

  • MOBI

  • WEB

  • English

$124.99
Minimum price
$124.99
Suggested price

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 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

Do Well. Do Good.

Authors have earned$10,803,456writing, publishing and selling on Leanpub, earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

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), EPUB (for phones and tablets) and MOBI (for 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

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF, EPUB and/or MOBI files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub