# Modular Monolith Architecture (Orbit): Full Technical Catalog > Complete discovery & reference digest for https://modularmonolith.com (curated overview at https://modularmonolith.com/llms.txt). Source repository: https://github.com/m-jovanovic/modular-monolith (`v2.0.0` / `3c8d0cf5601d287b645c1ca59b7b3e811659ec74`). ## Core Pages - [Orbit .NET 11 Modular Monolith Home](https://modularmonolith.com/) · [Markdown](https://modularmonolith.com/index.md) - [Interactive 6-Step Saga & Telemetry Tour](https://modularmonolith.com/tour/) · [Markdown](https://modularmonolith.com/tour.md) - [60-Second Docker & CLI Quickstart](https://modularmonolith.com/start/) · [Markdown](https://modularmonolith.com/start.md) - [Agentic Software Factory & Custom Domain Setup](https://modularmonolith.com/software-factory/) · [Markdown](https://modularmonolith.com/software-factory.md) - [Guides & Labs Index](https://modularmonolith.com/guides/) · [Markdown](https://modularmonolith.com/guides.md) - [Case Study: Module Extraction vs. Single Host](https://modularmonolith.com/case-studies/module-extraction/) · [Markdown](https://modularmonolith.com/case-studies/module-extraction.md) ## Guides & Runnable Labs (Full Summaries & Key FAQs) ### [Designing Bounded Contexts and Schema-per-Module Ownership](https://modularmonolith.com/guides/module-boundaries/) - **Kind**: Walkthrough · **Updated**: 2026-12-02 · **Markdown Mirror**: https://modularmonolith.com/guides/module-boundaries.md - **Summary**: Split a .NET 11 application into five isolated bounded contexts, each owning an exclusive PostgreSQL 18 schema with zero shared tables. - **Design Intent**: Assign one authoritative module owner to every invariant, table, and state transition. - **Companion Deep Dive**: https://milanjovanovic.tech/blog/module-boundaries-bounded-contexts - **Q: Why should a modular monolith use separate PostgreSQL schemas instead of separate databases?** — Separate schemas inside one PostgreSQL 18 instance enforce explicit data ownership and forbid cross-module SQL joins while keeping operational backups, connection pooling, and local Docker setup simple. - **Q: Why does Orbit forbid placing any tables in PostgreSQL's public schema?** — Forbidding tables in public prevents accidental shared-table coupling. Every EF Core DbContext, migration history table, outbox table, and Dapper SQL query must explicitly name its owning module schema. - **Q: Can Orders join catalog.products or inventory.stock_items in a read query?** — No. Orders snapshots SKU names and unit prices through ICatalogPublicApi when an order is placed and stores them in orders.order_items, keeping every read query local to the orders schema. ### [Preventing Overselling with FOR UPDATE Locks and Outbox Atomicity](https://modularmonolith.com/guides/contended-stock-reservation/) - **Kind**: Lab · **Updated**: 2026-12-02 · **Markdown Mirror**: https://modularmonolith.com/guides/contended-stock-reservation.md - **Summary**: Race five concurrent buyers for one scarce SKU in PostgreSQL 18 using deterministic FOR UPDATE row locks, xmin tokens, and atomic outbox commits. - **Design Intent**: Prove that concurrent order bursts never oversell inventory or drop integration events. - **Companion Deep Dive**: https://milanjovanovic.tech/blog/modular-monolith-architecture-dotnet - **Q: Why is an optimistic read-then-write check not enough for contested inventory?** — Under concurrent bursts, optimistic concurrency throws DbUpdateConcurrencyException for every contender except one, forcing noisy retry loops. Acquiring SELECT FOR UPDATE in sorted product_id order serializes contenders cleanly inside PostgreSQL. - **Q: Why sort product IDs before executing SELECT FOR UPDATE?** — If Order A locks Product 1 then Product 2 while Order B locks Product 2 then Product 1, PostgreSQL deadlocks. Sorting product IDs ascending guarantees a consistent lock acquisition order. - **Q: Why include xmin in the raw SELECT FOR UPDATE projection?** — EF Core's Npgsql provider maps PostgreSQL's hidden xmin system column as a concurrency token. Selecting *, xmin ensures EF Core populates the tracked concurrency token when materializing entities from raw SQL. ### [Choosing Synchronous PublicApi Calls vs. Integration Events](https://modularmonolith.com/guides/module-communication/) - **Kind**: Walkthrough · **Updated**: 2026-12-02 · **Markdown Mirror**: https://modularmonolith.com/guides/module-communication.md - **Summary**: Decide when a .NET module needs an immediate in-process PublicApi read versus an asynchronous integration event over the Outbox and EventBus. - **Design Intent**: Keep synchronous cross-module calls narrow and read-only while defaulting state propagation to durable events. - **Companion Deep Dive**: https://milanjovanovic.tech/blog/event-driven-communication-modules - **Q: When is a synchronous cross-module PublicApi call justified in a modular monolith?** — Use a synchronous PublicApi only when a command cannot validate or construct its local aggregate without an immediate read-only snapshot from another module, such as verifying active SKUs and snapshotting prices during order placement. - **Q: Why shouldn't Orders call Inventory synchronously to reserve stock during POST /api/orders?** — Calling Inventory synchronously from Orders couples checkout latency and availability to warehouse lock contention and forces either two-phase commits or partial rollback bugs if the second SaveChanges fails. ### [Topic-Routed Channels Service Bus with Outbox and Inbox](https://modularmonolith.com/guides/channels-outbox-idempotency/) - **Kind**: Lab · **Updated**: 2026-12-02 · **Markdown Mirror**: https://modularmonolith.com/guides/channels-outbox-idempotency.md - **Summary**: Build an in-memory .NET 11 pub/sub bus on System.Threading.Channels with O(1) topic routing, sub-10ms outbox wakeup, and idempotent inbox replay. - **Design Intent**: Eliminate single-queue head-of-line blocking and fan-out waste while preserving durable crash recovery. - **Companion Deep Dive**: https://milanjovanovic.tech/blog/outbox-pattern-dual-write-problem - **Q: Why not use a single System.Threading.Channel for the whole monolith?** — A single shared channel introduces head-of-line blocking: one slow or failing subscriber stalls unrelated modules, and retry loops re-execute sibling handlers that already succeeded. Orbit allocates a dedicated bounded channel per (topic, subscription). - **Q: How does Orbit avoid polling latency in its PostgreSQL Transactional Outbox?** — InsertOutboxMessagesInterceptor pulses OutboxWakeupSignal in SavedChangesAsync immediately after the transaction commits, waking the outbox worker in under 10 milliseconds while keeping a 2-second fallback poll. - **Q: What happens when a subscriber throws an exception after exhausting retries?** — ChannelSubscriptionHostedService moves the failed envelope into ChannelEventBus's dead-letter store without affecting healthy sibling subscribers on the same topic, allowing operators or agents to inspect and replay it. ### [Enforcing Module and SQL Schema Boundaries in CI](https://modularmonolith.com/guides/test-module-boundaries/) - **Kind**: Lab · **Updated**: 2026-12-02 · **Markdown Mirror**: https://modularmonolith.com/guides/test-module-boundaries.md - **Summary**: Catch illegal cross-module references, public schema leaks, and cross-schema Dapper SQL queries in 5 seconds with 49 .NET architecture tests. - **Design Intent**: Make architectural boundary drift fail the build before human code review begins. - **Companion Deep Dive**: https://milanjovanovic.tech/blog/schema-per-module-vs-database-per-module - **Q: Why aren't C# assembly reference checks enough to protect a modular monolith?** — A module with zero project references to Orders can still execute raw Dapper SQL like SELECT * FROM orders.orders over a shared connection string. Orbit scans both compiled assemblies and SQL strings across every module. - **Q: What does Orbit verify on every EF Core DbContext?** — SchemaPerModuleTests instantiates all five DbContexts and asserts a unique non-public default schema, snake_case table and column names, and schema-owned Outbox and Inbox tables. ### [Building an Agentic Software Factory with Skills and OpenTelemetry](https://modularmonolith.com/guides/agentic-software-factory/) - **Kind**: Lab · **Updated**: 2026-12-02 · **Markdown Mirror**: https://modularmonolith.com/guides/agentic-software-factory.md - **Summary**: Pair AGENTS.md, 8 composable SKILL.md workflows, 59 verification gates, and local Aspire OpenTelemetry traces so AI coding agents ship safely. - **Design Intent**: Give AI coding agents explicit module conventions, un-editable guardrails, and runtime observability. - **Companion Deep Dive**: https://milanjovanovic.tech/blog/build-modular-monolith-dotnet-step-by-step - **Q: Why do AI coding agents struggle in traditional monoliths without a software factory setup?** — Without explicit schema rules, vertical-slice templates, and runtime traces, agents take the shortest path that compiles: joining foreign tables, swallowing errors with exceptions, and guessing why async sagas stall. - **Q: How does sharing OpenTelemetry with coding agents improve reliability?** — Orbit propagates W3C trace_parent through PostgreSQL outbox_messages into ChannelEventBus spans and exports Traces, Metrics, and Structured Logs to a local Aspire Dashboard, letting agents inspect exact async failure spans instead of coding blind.