System Design Atlas

Ticket sales with assigned seats

06 / 10Worked example

The overall architecture

Which responsibility needs a runtime boundary, and which remains an internal module?

Domain tasks are now mapped to deployable runtime components. The ticket API accepts browser requests and webhooks. The worker processes durable inbox events, workflows, and outbox commands. The relational data store maintains the data governing seat assignments. The payment service is outside the system boundary.

Starting point The starting point is the transaction for H-17, B-17, T-17 and Inbox.

Assumptions for the example case

Example design for one event with 1,000 numbered seats. Each order contains exactly one seat. Hold, sale, payment and ticket are separate entities. All figures and targets are illustrative assumptions, not provider metrics. Admission scanning, resale, dynamic pricing and multi-seat orders are outside scope. Sources checked on 8 September 2026. The order model covers successful payments, including delayed success; final unpaid cancellations need their own terminal state before implementation.

Runtime components and storage boundary of the ticket platform

Runtime view: two processes, one store and external boundaries

Browser · Ticket interfaceSeat selection, checkout, order status
External payment servicePayment, repayment, status matching

Ticket platform · owned runtime

Ticket API · ProcessHolds, checkout and durable webhook ingestion
Relational data storeBinding, Hold, Order, Ticket, Inbox/Outbox
Worker · ProcessCheck inbox, clean holds, deliver outbox
  • Browser → APIHTTPS: Hold, Checkout, own status; API → Browser: Result
  • Payment service → APISigned webhooks; API → payment service: 2xx after inbox commit
  • API → storeHold/checkout transaction or separate inbox ingestion; store → API: commit/result
  • Worker → storePoll inbox/outbox, validate allocation and write atomically; store → worker: data/commit
  • Worker → payment serviceIdempotent payment/refund commands and status reconciliation; service → worker: result or unknown outcome
  • Browser and payment service
  • API and Worker
  • Transactional storage

API and Worker share a codebase and data storage. Each transaction runs entirely in one process; the inbox combines acceptance and later confirmation.

Browser and payment service reach the ticket platform via separate contracts. The database carries binding, inbox and outbox; the worker may start repeatedly.

Assign domain components to the API and worker

Interior view: domain modules within their processes

Ticket API · Process

Stocks and holdsCheck visitor assignment; allocate or release seat
Inventory → Checkout: tested H-17
Checkout and orderingAtomically persist B-17, Z-17, key and payment command
Webhook ingestionProvider → Webhook: Check signature; Webhook → Inbox: Commit before 2xx

Worker · Process

Confirmation and compensationInbox → Confirmation: Assign payment and check current hold
Confirmation → inventory: apply shared rules
Inventory rulesLock the seat row; convert a valid hold into a sale allocation
Outbox deliveryOutbox → Payment service: Payment or refund with stable key

Shared inventoryAPI and worker → relational store. The API writes the inbox; the worker writes allocation, hold, order, ticket or compensation and inbox completion in its own transaction.

Separate commitsCheckout writes B-17 and payment outbox. A later confirmation or compensation has its own commit; external calls are made afterwards.

Modules are parts of the same application. Inventory is used by API and Worker; the confirmation transaction is completely part of the Worker.

The internal view assigns responsibilities: the API accepts holds, checkout and webhooks; the worker handles confirmation and external commands. Shared domain modules are code boundaries, not separate services.

Reasoning for starting architecture

Modular monolith
A modular codebase maps the Ticket API and Worker as separate processes. Common domain modules use the same relational data store. A transaction always belongs to a specific use case in a process; it does not span API/worker calls.
Asynchronous worker
Webhook acceptance and confirmation are decoupled. This leaves the HTTP response short and the business effect repeatable after a crash.
Product neutral roles
Database, queue and cache are described as roles. A concrete product choice only follows from the operating environment, team knowledge and measured requirements.

Terms in this step

Runtime view
The runtime view shows deployable processes, stores and external boundaries.
Component view
The component view shows responsibilities within an application; it does not claim separate services.

Try it yourself

Draw browser, ticket API, relational storage, worker and payment service with directed messages. Assign inventory, checkout, webhook and confirmation to their processes and mark the shared data storage.

A hint for your attempt

A codebase can run API and Worker as separate processes. The confirmation transaction runs entirely in the worker; a webhook acceptance has its own transaction in the API.

Compare with a possible solution
Runtime
Browser → API for holds, checkout and status; payment service → API for webhooks; API → store for orders and inbox records. Worker → store for reads and commits; worker → payment service for payment and refund commands. Each confirmation runs in its own transaction.
Modules
In the API, inventory validates holds, checkout creates B-17 and a payment command, and webhook handling ingests EV-17. In the worker, confirmation applies inventory rules and writes T-17 or a refund command. API and worker share code and storage, but no transaction spans their calls.

Apply to your project

Which domain changes must share a transaction, and which may cooperate asynchronously?

In the next step, the architecture is specifically tested on the riskiest message flow.