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 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:

  • Share this book

  • Categories

    • Node.js
    • Event-Driven Architecture
    • Reactive
    • Software Architecture
  • 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

  • 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

  • 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 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...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course 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

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 and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub