Leanpub Header

Skip to main content

From Services to Runtime

This book is 100% completeLast updated on 2026-08-11

Microservices aren't built with boxes on a diagram—they're built with owned truth, stable contracts, idempotent messages, and controlled failure.

Minimum price

$199

$299

You pay

Author earns

$

Also available for 8 book credits with a Reader Membership

PDF
About

About

About the Book

A microservice architecture does not become real when services are drawn as boxes on a diagram.

It becomes real when each service owns its truth, protects its invariants, publishes stable contracts, survives duplicate messages, exposes meaningful health signals, fails without corrupting the system, and can be deployed, observed, migrated, and recovered independently.

From Services to Runtime is an architecture and implementation blueprint for turning the NEXUS-1 service model into a disciplined microservice runtime built around .NET, service-owned data, asynchronous messaging, explicit contracts, operational evidence, and controlled failure.

This book begins where high-level microservice discussions usually stop.

It does not merely ask which services should exist. It asks the harder engineering questions:

  • Who owns each business fact?
  • Which service is allowed to write which data?
  • What must remain transactionally consistent?
  • What happens when a message is delivered twice?
  • How is an unknown commit outcome handled safely?
  • When is eventual consistency acceptable?
  • How does the user interface communicate delayed truth?
  • Which health check proves that a service is actually ready?
  • How are migrations, credentials, retries, rollback, recovery, and shutdown controlled?
  • What evidence would justify the claim that the runtime behaves as designed?
From Architectural Boundaries to Runtime Responsibilities

The book develops a bounded reference slice around three service owners:

  • AlarmManagement, which owns alarm observations and alarm-flood decisions.
  • RootCause, which owns root-cause cases, evidence, and verdicts.
  • Reporting, which owns derived projections, checkpoints, and freshness-bearing reporting truth.

A Query BFF provides the controlled synchronous edge, while public facts connect the owners asynchronously.

Through this slice, the reader follows the complete engineering path from domain decision to runtime effect:

  • aggregates and invariants,
  • application commands and outcomes,
  • service-owned databases,
  • EF Core mappings and provider-backed transactions,
  • inbox and outbox patterns,
  • idempotent consumers,
  • public event contracts and versioning,
  • delayed projections,
  • authentication and authorization,
  • startup, liveness, and readiness,
  • observability and distributed tracing,
  • failure injection and recovery,
  • migration and rollback,
  • Docker Compose and Kubernetes delivery,
  • architecture, component, contract, integration, and runtime tests.

The purpose is not to present isolated patterns. It is to show how the patterns constrain one another inside one coherent distributed system.

A Large Legacy Estate Without Invented Service Boundaries

The wider NEXUS-1 estate is described as containing 654 tables across 17 schemas.

This book does not pretend that 654 tables imply 654 services—or that 17 schemas imply 17 bounded contexts. Database structure is treated as evidence to investigate, not as a ready-made service map.

The three-owner reference slice demonstrates a migration and implementation method. It does not claim to be the final decomposition of the entire legacy estate.

Before any additional service can be admitted, the book requires evidence about business capability, invariants, write authority, transaction boundaries, identity lifecycle, failure isolation, security responsibility, operational ownership, and migration cost.

Unknown remains an acceptable engineering state. Invented certainty does not.

What Makes This Book Different?

Many microservice books describe the desired architecture after all difficult decisions appear to have been made.

This book keeps those decisions visible.

It connects architecture to concrete implementation responsibilities and repeatedly asks what would falsify each claim. Code listings, database mappings, configuration examples, contract definitions, deployment manifests, tests, failure scenarios, and evidence records are presented as parts of the same engineering argument.

Throughout the book, the reader encounters a consistent progression:

  1. The engineering problem — the runtime risk that must be controlled.
  2. The architectural decision — the boundary or responsibility being established.
  3. The implementation shape — C#, EF Core, SQL, messaging, configuration, or deployment material.
  4. The failure model — what delay, duplication, timeout, partial progress, or restart can do.
  5. The test or evidence obligation — what must be observed before a stronger claim is permitted.
  6. The honest verdict — what is specified, illustrated, implemented, executed, demonstrated, deferred, or not claimed.

This makes the book useful not only as a guide to microservices, but also as a method for reasoning about distributed systems without hiding their uncertainty.

Who Is This Book For?

This book is written for:

  • experienced .NET developers moving beyond CRUD-oriented service design,
  • software and solution architects,
  • backend and distributed-systems engineers,
  • database engineers working on service ownership and migration,
  • technical leads responsible for delivery and operational quality,
  • engineers designing message-driven systems,
  • advanced readers who want to connect DDD, testing, infrastructure, security, observability, and failure recovery into one coherent method.

The reader does not need prior knowledge of nuclear engineering. NEXUS-1 provides the demanding industrial context, but the architectural lessons apply to any system in which truth, authority, failure, delayed consistency, traceability, and recovery matter.

The Honest Boundary

From Services to Runtime is a definitive book artifact and a complete architecture and implementation blueprint. It is not presented as a completed software implementation.

The microservice reference application described by the book has not been implemented as an admitted repository and runtime. Restore, compilation, automated tests, database migrations, container execution, broker behavior, failure campaigns, and end-to-end runtime reproduction have therefore not been executed for that future application.

The listings define intended responsibilities and falsifiable acceptance obligations. They must not be mistaken for retained execution evidence.

The existing NEXUS-1 Phase-0 demonstrator can be explored in the browser, but it does not constitute proof that the microservice runtime specified in this book has already been built:

Explore the NEXUS-1 Phase-0 demonstrator:
https://gregory82gr.github.io/Nexus-1-phase-0/

Supporting material and project artifacts are published with the wider NEXUS-1 work:

Project repository:
https://github.com/gregory82gr/Nexus-1-phase-0

NEXUS-1 remains an educational Phase-0 demonstrator. It is not safety-class software, certified operational guidance, or a system connected to any real industrial or nuclear facility.

A Personal Dedication

This book is dedicated to the woman who devoted her life to me. I can only dedicate this book to her—to my wife, Vladimirka.

The Central Promise

This book does not promise that microservices make systems simple.

It promises something more useful: a disciplined way to decide where complexity belongs, who owns each truth, how failure is contained, how recovery is designed, and what evidence must exist before architecture is allowed to become a runtime claim.

Nothing claims to exist that does not.

Author: Grigorios Kyriakos Agathangelidis.

Greek name: Γρηγόριος Κυριάκος Αγαθαγγελίδης.

Also searchable as: Αγαθαγγελίδης Γρηγόριος, Αγαθαγγελιδης Γρηγοριος, Grigorios Agathangelidis.

Author

About the Author

Grigorios Agathangelidis

My name is Grigorios Agathangelidis, and my professional background is in Software Engineering and Systems Architecture. I am not a distributed-systems theorist, a formal-verification researcher, or a production-microservices specialist. *From Services to Runtime* is not the result of years of operating large-scale distributed systems in production; rather, it is the product of extensive independent study, research, and a passion for understanding how to build systems that are honest about their boundaries.

*From Services to Runtime* began as a personal challenge: to take an existing, well-tested modular architecture and move it into a distributed runtime—not because distribution is fashionable, but because it forces a system to confront its own assumptions about ownership, consistency, failure, and time. The book documents that journey, showing exactly what changes when a local decision becomes a remote interaction, a transaction becomes several local commits, and a test suite becomes a family of unit, integration, contract, end-to-end, and recovery tests.

Throughout the project, I have sought to approach the subject with rigor, clarity, and respect for the limits of my expertise. The architecture and implementation presented in this book are educational and demonstrative in nature. They are not safety-class software, not certified operational guidance, and not connected to any real facility. Where models, assumptions, or implementations are simplified rather than production-grade, I have made every effort to state this clearly.

My broader interest extends beyond microservices themselves to the challenges of designing, building, and reasoning about complex distributed systems. This includes topics such as architectural governance, data ownership, message-driven architectures, eventual consistency, security boundaries, observability, migration discipline, and failure recovery.

The vision behind this volume is not to present a production-ready reference implementation, but to provide a coherent, evidence-driven blueprint for learning, exploration, and experimentation—one that combines architectural rigor, software engineering practice, and systems thinking into an accessible and testable framework.

This release represents a companion implementation blueprint to the wider NEXUS-1 project: a Phase-0 educational demonstrator designed to teach boundaries, service-owned truth, public contracts, messaging, delayed consistency, security boundaries, observability, migration discipline, and failure recovery. The long-term roadmap continues with the wider NEXUS-1 series, exploring everything from domain-driven design and formal proof to real-world deployment and operational resilience.

Above all, *From Services to Runtime* reflects a belief that meaningful innovation often begins with curiosity, disciplined learning, and the willingness 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
    • Standing Boundary and Copyright Note
    • Scope of This Definitive Final Edition
    • How to Read This Book
    • Series Position
    • The Executable Slice
    • Method
    • The Evidence Rule
    • No-Claim Rule
  • PART I - Crossing into Distribution
    • Chapter 1: The Handoff from From Flow to Services
    • Chapter 2: What Must Remain True After Extraction
    • Chapter 3: Choosing the First Distributed Slice
    • Chapter 4: Repository and Solution Topology
    • Chapter 5: Shared Nothing, Shared Little
    • Chapter 6: Definition of Done for a NEXUS-1 Service
  • PART II - The Service Foundation
    • Chapter 7: The Golden-Path Service Template
    • Chapter 8: Host Composition and Dependency Direction
    • Chapter 9: Domain, Application, Infrastructure, and Edge Inside a Service
    • Chapter 10: Configuration and Environment Boundaries
    • Chapter 11: Liveness, Readiness, and Startup Dependencies
    • Chapter 12: The Testing Pyramid for a Distributed Service
  • PART III - Data Ownership in Executable Form
    • Chapter 13: From Seventeen Schemas to Service-Owned Databases
    • Chapter 14: Building AlarmManagementDb
    • Chapter 15: Building RootCauseDb
    • Chapter 16: Independent Migrations and Database Lifecycle
    • Chapter 17: Cross-Service Identity Without Cross-Database Foreign Keys
    • Chapter 18: Local Transactions, Concurrency, and Commit Boundaries
  • PART IV - Public Contracts and the Synchronous Edge
    • Chapter 19: Domain Events, Integration Events, and API Contracts
    • Chapter 20: The Versioned Message Envelope
    • Chapter 21: Commands and Queries at a Service Boundary
    • Chapter 22: The Operator Console BFF
    • Chapter 23: Versioning, Problem Details, and Idempotency Keys
    • Chapter 24: Contract Compatibility Tests
  • PART V - The Message Backbone
    • Chapter 25: RabbitMQ Topology for NEXUS-1
    • Chapter 26: The Transactional Outbox in Each Producer
    • Chapter 27: Dispatch, Publisher Confirms, and Recovery
    • Chapter 28: Inbox and Idempotent Consumers
    • Chapter 29: Retry, Backoff, Dead Letters, and Poison Messages
    • Chapter 30: Ordering, Duplication, and Contract Evolution
  • PART VI - The First End-to-End Distributed Slice
    • Chapter 31: AlarmManagement Enters the Runtime
    • Chapter 32: Publishing AlarmFloodDetected.v1
    • Chapter 33: RootCause Consumes and Opens a Case
    • Chapter 34: A Verdict Fans Out to Audit and Compliance
    • Chapter 35: Reporting Builds Delayed Truth
    • Chapter 36: The Complete Slice and the Optional RL Advisory Branch
  • PART VII - Workflow, Consistency and Repair
    • Chapter 37: The NEXUS-1 Distributed Process Manager
    • Chapter 38: Choreography, Orchestration, and the Decision Record
    • Chapter 39: Timeouts, Escalations, and Human Review
    • Chapter 40: Compensation Without Pretending to Undo History
    • Chapter 41: Eventual Consistency in the Operator Experience
    • Chapter 42: Reconciliation and Repair Jobs
  • PART VIII - Security and Trust Across Services
    • Chapter 43: Threat and Trust Boundaries Before Mechanisms
    • Chapter 44: Edge Authentication and Operator Authorization
    • Chapter 45: Service-to-Service Identity
    • Chapter 46: Claims Minimization and Policy Mapping
    • Chapter 47: Secrets, Certificates, and Configuration Handling
    • Chapter 48: Security Tests and Audit Evidence
  • PART IX - Observability and Resilience
    • Chapter 49: Correlation and Causation Across Every Boundary
    • Chapter 50: Structured Logs That Preserve Domain Meaning
    • Chapter 51: Distributed Tracing with OpenTelemetry
    • Chapter 52: Metrics, Service Objectives, and Dashboards
    • Chapter 53: Timeout, Retry, Circuit Breaker, and Bulkhead
    • Chapter 54: Failure Injection and Recovery Evidence
  • PART X - Migration, Delivery, and Final Architecture
    • Chapter 55: The Reproducible Docker Compose Runtime
    • Chapter 56: Extracting Without a Big- Bang Rewrite
    • Chapter 57: CI Quality Gates and Container Images
    • Chapter 58: Rollout, Database Change, and Rollback
    • Chapter 59: Translating Proven Needs to Kubernetes
    • Chapter 60: The Final NEXUS-1 Distributed Demonstrator
  • Back Matter
    • Epilogue - What the Runtime Has Actually Proved
    • Appendix A - Solution and Project Map
    • Appendix B - Service Catalogue
    • Appendix C - API and Event Contract Catalogue
    • Appendix D - Configuration Reference
    • Appendix E - Failure Scenario and Recovery Catalogue
    • Appendix F - Security and Trust Boundary Notes
    • Appendix G - Commands, Scripts, and Reproduction Guide
    • Glossary - Microservice and Distributed- Systems Terms
    • Mathematical and Timing Notation Used in the Book
    • Sources and Reference Notes
    • Working Index
    • Final Consistency Audit
    • Final Reproduction Readiness and Deferred Evidence Checkpoint
    • Final Publication Artifact and Build Identity
    • Final Page- Aware Index

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