The Hotel — A Distributed System From First Principles


Every pattern in the Core Concepts series has a working implementation. This is where it lives.

The Lab series designs a hotel management system from first principles — one capability at a time, one pattern at a time. Before a line of code is written, the capabilities are identified, their boundaries are drawn, and their interactions are mapped. The implementation follows from that design. Not the other way around.

By the end of the series you will have produced the artifacts a real system requires — a complete capability map, formal event contracts, OpenAPI and AsyncAPI specifications, and eventually running code. Each artifact builds on the previous. Each is useful on its own.


Why a Hotel

Hotels are immediately understood. Everyone has checked in somewhere. The sequence of events — arrival, room assignment, luggage, the bill at the end — is familiar without explanation. That familiarity matters because it lets the architecture be the subject rather than the domain.

Hotels also contain exactly the right amount of complexity. Enough capabilities to show a real network. Enough triggers to demonstrate every pattern. Not so many that the domain gets in the way of the architecture.

And hotels have a property that makes them ideal for teaching distributed systems: most of what happens at a hotel happens because something else happened first. A room becomes available because housekeeping finished. A guest gets reassigned because maintenance raised a ticket. The bill closes because the guest checked out. The system is event-driven by nature.


The Capabilities

Eight capabilities. Each owns its domain, its data, and its decisions. None shares a database. None reaches into another's internals. They connect only through commands and events.

Reservations — booking, availability, check-in, check-out. Owns the booking lifecycle from first inquiry to final departure.

Room Management — room inventory, status, and assignment. Knows which rooms exist, what type they are, and whether they are available, occupied, cleaned, or on hold.

Housekeeping — cleaning schedules, room inspection, and readiness. Publishes the fact that a room is ready. Does not decide what happens next.

Maintenance — service tickets, repairs, and room holds. When something breaks, Maintenance owns the resolution. When a room goes on hold, it tells Room Management.

Concierge — guest requests, luggage, and special arrangements. Reacts to guest arrivals and departures. Handles the physical logistics the other capabilities do not own.

Guest Profile — identity, preferences, and stay history. The permanent record of who the guest is. Never drives a process — always informs one.

Billing — charges, folios, and settlement. Accumulates charges throughout the stay. Closes the account at checkout.

Notifications — guest and staff communications. Reacts to events across the system and delivers the right message to the right person. Knows how to communicate. Does not decide when to.


The Design Before the Code

The instinct in most development projects is to start building and document later. The lab series deliberately inverts this. Every lab begins with the design question — what is this capability responsible for, what does it need from others, what does it publish — before any implementation is considered.

This is not idealism. It is the most practical approach available. A system designed before it is built can be changed at the design level — cheaply, quickly, without touching code. A system designed after it is built can only be changed by modifying the code — expensively, slowly, with risk at every step.

The hotel system will be designed completely before it is implemented. That is the point.


Part 1 — Business Architecture

The first seven labs build the complete business architecture of the hotel system. No code. No specifications. Design artifacts — capability maps, interaction diagrams, event names, cascade documentation, and domain vocabulary.

Deliverable at Lab 07: a complete, formal, implementable architecture. Every capability identified. Every interaction mapped. Every cascade documented. A business architect who completes Part 1 has everything a capable engineering team needs to build the system — without writing a single line of code.

Labs 01–04 are available to all readers. Labs 05–07 are available to subscribers.

Lab Title Pattern Access Status
01 The simplest event Event contract Public Live
02 The first orchestration Orchestration Subscriber Coming
03 The first downstream cascade Choreography Subscriber Coming
04 The projection pattern Projection Subscriber Coming
05 The first compensation Compensation Paid Coming
06 The saga Saga Paid Coming
07 Full checkout — the complete map All patterns Paid Coming

Part 2 — Technical Architecture

The next four labs bridge the business architecture into formal technical specifications. Lab 08 introduces the three developer artifacts and shows how they connect to the capability map produced in Lab 07. Labs 09-11 produce each artifact in full.

Deliverable at Lab 11: a fully specified system. Every API documented. Every event contract defined. Every trust requirement expressed. A developer who receives these artifacts can implement any capability independently — without needing to understand the others.

Lab 08 is available to subscribers. Labs 09-11 are available to paid subscribers.

Lab Title Access Status
08 Developer artifacts — an introduction Subscriber Coming
09 Capability Contracts — OpenAPI Paid Coming
10 Event Contracts — AsyncAPI Paid Coming
11 Trust Envelope and Identity Paid Coming

Part 3 — Implementation

The final part builds the running system. This is where the infrastructure decisions are made — broker selection, deployment topology, consumer threading model, observability. The choices made here must honour the promises the specifications made in Part 2.

Deliverable: running code that implements the design. The infrastructure that makes the design's promises real in production.

Part 3 is available to paid subscribers.

Lab Title Focus Access Status
12+ Running the system Code and infrastructure Paid Coming

Lab 01 is live. Subscribe to be notified when each new lab is published, or follow the announcement posts on the main feed.

Subscribe to 8861 Lab

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe