Examples
Every runnable example in this repo, mapped to the chapter it supports.
Every hands-on chapter in this book points at a matching directory under
examples/
in the repo. 00-monolith is the Django system the whole book decomposes, and
each later directory is a FastAPI service extracted from it, the same code the
chapters quote. The monolith is Django; every extracted service is
Python/FastAPI.
| Example | What it shows | Chapter |
|---|---|---|
| 00-monolith | The Django 5.2 + DRF monolith, all six bounded contexts in one project, one Postgres schema, checkout as one synchronous function. The walking skeleton the book strangles. | Designing the Monolith |
| 01-strangler-proxy | A thin ASGI reverse proxy in front of the monolith, so bounded contexts peel off one seam at a time behind a flag. | The Strangler Fig Pattern |
| 02-review-service | The review context extracted onto its own FastAPI service, lift onto FastAPI, then re-author to idiomatic. |
Extraction 1: Review Service |
| 03-notification-service | The notification context extracted as a net-new, event-driven FastAPI service consuming order.placed. |
Extraction 2: Notification Service (Going Event-Driven) |
| 04-inventory-service | The inventory context extracted with two protocol surfaces, fed from the monolith by log-based change data capture. |
CDC, Transaction Log Tailing & Extraction 3: Inventory |
| 05-payment-service | The payment context extracted as a choreographed saga participant, write path net-new. |
Distributed Transactions, the Saga & Extraction 4: Payment (choreographed) |
| 06-shipping-service | The shipping context extracted as an orchestrated saga step. |
Orchestrated Sagas & Extraction 5: Shipping (FastAPI Saga Coordinator) |
| 07-order-service | The order context (the god place_order() and its saga reactions) extracted CQRS from day one, with its own transactional outbox. |
Communication Styles & Extraction 6: Order + GraphQL Gateway |
| 08-graphql-gateway | A data-less Strawberry GraphQL aggregation gateway composing the extracted services into one read view. | Communication Styles & Extraction 6: Order + GraphQL Gateway |
| 09-schema-registry-demo | An Avro + Apicurio schema-registry demonstrator, additive to the projectβs JSON event flows. | Contracts & the Service Registry |
| 10-supply-chain | The supply-chain gate: SBOM generation, CVE scan, and policy-as-code over the images this project builds. | CI/CD, GitOps, Progressive Delivery & Supply Chain |
Running the examples
The services run together as one stack, not as isolated snippets. From the repo
root, scripts/stack-up.sh builds and starts the monolith, the strangler proxy,
and the extracted services over compose.yaml; the Newman contract suite in
tooling/newman/ asserts behaviour equivalence across the seam; and
scripts/stack-down.sh tears it back down.
./scripts/stack-up.sh # build + start the stack
# ... exercise it; run the Newman contract suite ...
./scripts/stack-down.sh # stop + clean up
Each directory under examples/ has its own README.md with the specifics for
that service. The supply-chain gate (10-supply-chain) is self-contained and
runs on its own with ./demo.sh. See
Prerequisites for the full
toolchain setup.