Leanpub Header

Skip to main content

From Context to Flow

This book is 100% completeLast updated on 2026-07-07

Advanced DDD before microservices: From Context to Flow shows how NEXUS-1 moves from bounded contexts to domain events, integration events, outbox, sagas, anti-corruption layers, auditability, and eventual consistency.

Minimum price

$119.99

$179.99

You pay

Author earns

$

Also available for 5 book credits with a Reader Membership

PDF
About

About

About the Book

From Context to Flow is the advanced Domain-Driven Design bridge volume of the NEXUS-1 series. Where From Domain to Twin introduced the essential DDD vocabulary, this book takes the next step: it shows what happens when a domain model begins to move across boundaries as events, contracts, workflows, failures, retries, projections, audits, and delayed consistency.

This is not a microservices implementation guide. It is the book that should come before microservices. Its central question is simple:

Before we split a system into services, do we truly understand its boundaries, its language, its ownership, and its flows?

Using the NEXUS-1 digital-twin demonstrator as a coherent teaching system, the book follows a realistic architectural flow:

Alarm Raised → Alarm Flood Detected → Root-Cause Case Opened → Evidence Attached → Verdict Issued → Recommendation Generated → Audit Entry Written → Compliance Review Triggered

This flow crosses several bounded contexts: ReactorFleet, Instrumentation, AlarmManagement, RootCause, DigitalTwin, ReinforcementLearning, Audit, Compliance, and Reporting. That makes it an ideal environment for advanced DDD because every step forces a serious architectural question: who owns the rule, who publishes the event, who reacts to it, what must remain private, what becomes a public contract, and what happens when the next context is temporarily unavailable?

The book explains advanced DDD patterns in practical language: context maps, upstream/downstream relationships, customer/supplier relationships, conformist relationships, shared kernel, anti-corruption layers, published language, domain events, integration events, outbox, inbox, idempotency, dead-letter handling, process managers, sagas, compensation, timeouts, and eventual consistency.

It also draws a clear line between things that are often confused:

A domain event is not automatically an integration event.
An audit entry is evidence, not workflow.
A bounded context is not automatically a microservice.
A recommendation is not a command.
A projection is not the source of truth.
A retry is not a business decision.
A compensation is not a rollback.

Every chapter keeps the NEXUS-1 standing rule: nothing claims to exist that does not. The book does not pretend that distributed architecture is free. Every pattern is explained with its benefit, its cost, and its honest boundary.

This book is written for C#/.NET developers, software architects, and advanced learners who already understand the basics of DDD and want to move from modelling to architectural flow. It is especially useful for readers who want to understand how a modular system becomes ready for microservices without rushing into deployment boundaries too early.

By the end of the book, you should be able to look at a large system and ask better questions:

Which context owns this language?
Which aggregate protects this rule?
Is this event internal, external, or only an audit fact?
Does this workflow belong inside one application service, or does it need a process manager?
Is this dependency healthy, or does it require an anti-corruption layer?
Can this context become a microservice, or is it only a module with a fashionable name?

The goal is not to make the system more distributed.
The goal is to make the system more honest before distribution begins.

This book is dedicated to Eystathios Andreadis — my brotherly friend and an outstanding surgeon — who reminds us every single day that there are still people whose integrity, compassion, and dedication set them apart.

Author: Grigorios Kyriakos Agathangelidis
Greek name: Γρηγόριος Κυριάκος Αγαθαγγελίδης
Also searchable as: Αγαθαγγελίδης Γρηγόριος, Αγαθαγγελιδης Γρηγοριος, Grigorios Agathangelidis.

Share this book

Author

About the Author

Grigorios Agathangelidis

My name is Grigorios Agathangelidis, and my professional background is in Electrical Engineering and Software Engineering. My work focuses on the point where software architecture, systems thinking, data modelling, simulation, and decision-support systems meet.

The NEXUS-1 series began as an independent effort to understand and model a complex industrial digital-twin environment through software. Over time, it has grown into a coherent body of companion books covering nuclear-plant simulation, root-cause analysis, reinforcement learning, SQL Server schema design, Entity Framework Core, Domain-Driven Design, Clean Architecture, auditability, and now advanced DDD patterns before microservices.

I am not a nuclear physicist, nuclear engineer, or nuclear power-plant specialist. NEXUS-1 is not certified operational software and is not connected to any real facility. It is an educational and architectural demonstrator: a way to explore how complex systems can be named, structured, explained, simulated, audited, and reasoned about with discipline.

My broader interest is not only the nuclear domain itself, but the challenge of building understandable software for difficult domains. That includes bounded contexts, digital twins, event-driven workflows, root-cause reasoning, verification and validation, explainable AI, local AI-assisted analysis, audit trails, compliance records, and the careful separation between recommendation, command, evidence, and truth.

In From Context to Flow, I continue the architectural path of NEXUS-1 by asking what must be understood before a system is split into microservices. The book reflects my belief that good architecture is not created by fashionable technology names, but by honest boundaries, precise language, protected domain rules, visible flows, and respect for the cost of distribution.

Above all, NEXUS-1 reflects a personal conviction: meaningful software work begins with curiosity, disciplined learning, and the courage to explore unfamiliar domains with both ambition and humility.

Author: Grigorios Kyriakos Agathangelidis
Greek name: Γρηγόριος Κυριάκος Αγαθαγγελίδης
Also searchable as: Αγαθαγγελίδης Γρηγόριος, Αγαθαγγελιδης Γρηγοριος, Grigorios Agathangelidis.

Contents

Table of Contents

  • Front Matter
    • Cover
    • Standing Boundary and Copyright Note
    • Dedication
    • Contents
    • Preface — Why Contexts Are Not Enough
    • How to Read This Book
    • Where This Book Sits in the NEXUS-1 Series
    • The Advanced DDD Bridge Before Microservices
  • Part I — From Basic DDD to Advanced DDD
    • 1 · Why Advanced DDD Exists
    • 2 · The Limits of One Clean Model
    • 3 · Bounded Contexts Revisited
    • 4 · Strategic Design vs Tactical Design
    • 5 · NEXUS-1 as an Advanced DDD Candidate
  • Part II — Context Maps and Relationships
    • 6 · Reading a Context Map
    • 7 · Upstream and Downstream Contexts
    • 8 · Customer/Supplier Relationships
    • 9 · Conformist and Shared Kernel
    • 10 · Anti-Corruption Layers
    • 11 · Published Language
    • 12 · Context Relationship Map for NEXUS-1
  • Part III — Domain Events and Integration Events
    • 13 · Events Are Not All the Same
    • 14 · Domain Events
    • 15 · Integration Events
    • 16 · Audit Events Are Not Integration Events
    • 17 · Event Naming and Language Discipline
    • 18 · Event Payloads and Contract Shape
  • Part IV — Transactions, Outbox, and Reliability
    • 19 · The Outbox Pattern
    • 20 · Outbox Table Design
    • 21 · Consumer Idempotency and the Inbox Pattern
    • 22 · Publishing from the Outbox
    • 23 · Retries, Dead-Letter Queues, and Poison Messages
    • 24 · Failure Case Walkthrough
  • Part V — Process Managers and Sagas
    • 25 · When an Application Service Is Not Enough
    • 26 · Process Manager vs Saga
    • 27 · The Alarm-to-Compliance Flow
    • 28 · Designing a Process Manager
    • 29 · What Must Not Go Inside an Aggregate
    • 30 · Compensation Instead of Rollback
    • 31 · Timeouts and Escalations
    • 32 · NEXUS-1 Process Manager Example in C#
  • Part VI — Eventual Consistency
    • 33 · The End of Immediate Truth
    • 34 · Strong Consistency vs Eventual Consistency
    • 35 · Consistency Boundaries
    • 36 · Reporting, Compliance, and Audit Consistency
    • 37 · User Experience Under Eventual Consistency
    • 38 · NEXUS-1 Consistency Map
  • Part VII — Protecting the Domain
    • 39 · Keeping Infrastructure Out
    • 40 · Contracts at the Boundary
    • 41 · Testing Model Boundaries and Flows
  • Part VIII — Microservice Readiness
    • 42 · When a Context Can Become a Service
    • 43 · Data Ownership
    • 44 · APIs, Messages, and Runtime Boundaries
    • 45 · The Final Pre-Microservices Checklist
  • Back Matter
    • Sources and Reference Notes
    • Glossary of Advanced DDD Terms
    • Working Index
    • Final Consistency Audit
    • Final Checkpoint

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

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.

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 earned over $15 million writing, 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