Chapters

The whole book, in order.

Every part and chapter, linked. Read it top to bottom the first time through; each chapter also stands on its own once the lab exists. New here? Start with the Outline.

Part 0 Prerequisites & the Lab

Get the contract-first toolchain running locally: Quarkus, FastAPI, Docker Compose + LGTM, and the shipping/cargo domain.

  1. 0 Prerequisites & the Lab Set up the contract-first lab: the Quarkus and FastAPI toolchains, the Docker Compose stack with LGTM observability, and the shipping and cargo domain you'll build against.

Part 1 Foundations & the decision lens

Decide whether REST fits the interaction in front of you and name the constraint your design choice actually rests on.

  1. 1 APIs & patterns RPC versus Web APIs, the REST constraints, and resource-oriented architecture: the mental model the later chapters build on.
  2. 2 The API decision framework The criteria axes for choosing a pattern, style, and transport: the lens applied in a Decision callout at the end of every chapter.

Part 2 Designing resources with a contract

Model a domain as resources and express it as an OpenAPI 3.1 contract that CI enforces against both stacks.

  1. 3 Designing around resources Model the domain as resources: nouns not verbs, collections versus items, and why mirroring your database tables produces a chatty, leaky API.
  2. 4 Contract-first with OpenAPI Write the bookings and cargo contract as one OpenAPI document, implement it on both stacks, and fail the build when a response drifts from the schema.
  3. 5 HTTP methods & the idempotency matrix Which methods are safe, which are idempotent and why it matters, with an idempotent PUT and a correct DELETE built in both stacks.

Part 3 HTTP semantics done right

Return correct status codes, headers and representations, and do partial updates two correct ways: JSON Patch and Merge Patch.

  1. 6 Content negotiation & status codes Serve the representation the client's Accept names, reject the wrong Content-Type, and return the status code the spec defines: 406, 415, and the 2xx, 4xx and 409 set.
  2. 7 Partial updates: JSON Patch vs Merge Patch Two standard ways to change part of a resource, RFC 7396 JSON Merge Patch and RFC 6902 JSON Patch: their media types, trade-offs and when each fits.

Part 4 Collections at scale

Design collection endpoints that stay fast and safe under load, and match the pagination strategy to the access pattern.

  1. 8 Filtering, projection & pagination Keep collection endpoints fast and safe under load: filter and project fields, choose among offset, keyset and seek pagination, and clamp limit as a denial-of-service guard.
  2. 9 Sub-resources When nesting a resource under its parent expresses real ownership and when it's a trap: the caching cost, the redundant-endpoint pitfall, and how deep is too deep.

Part 5 Asynchronous work & jobs

Model work that doesn't finish within one request/response: long-running operations and rerunnable server-owned jobs.

  1. 10 Asynchronous & long-running operations Model work that outlasts one request: return 202 with a Location to an operation resource, let the client poll it, redirect with 303 to the result, and offer a cancel.
  2. 11 Rerunnable jobs Model recurring, server-owned work: separate the schedule from each execution's run record, so a job fires on a timer and on demand without the client driving every run.

Part 6 Evolution & lifecycle

Evolve an API without breaking clients and delete under compliance rules: HATEOAS, soft deletion/GDPR purge, and versioning.

  1. 12 HATEOAS Let the response carry the links: expose exactly the state transitions valid from a resource's current state, so a client drives the booking lifecycle by following links instead of hard-coding URLs and rules.
  2. 13 Soft deletion & GDPR purge Delete without losing the audit trail, then erase for good under compliance: soft delete hides a booking from normal reads while keeping it addressable for audit, and a purge honors the GDPR right to erasure.
  3. 14 Versioning Evolve the API without breaking clients: compare URI, query, header and media-type versioning, serve an old and a new representation of one resource, and see what each choice does to caching.

Part 7 Large payloads & streaming

Move large or continuous data over REST with Range requests, chunked transfer, SSE, and NDJSON, and recognize when to leave REST behind.

  1. 15 Large binary resources & Range requests Serve a large manifest without forcing clients to download it whole: HEAD for metadata, Accept-Ranges, byte-range requests answered with 206 Partial Content and Content-Range, and 416 for an unsatisfiable range.
  2. 16 Streaming deep-dive Push data as it is produced: chunked transfer encoding, Server-Sent Events for live updates, and NDJSON for bulk export, and how to check that a response arrives incrementally instead of buffered.
  3. 17 Cross-protocol choices When to leave REST: how REST and SSE compare with WebSockets, webhooks, and gRPC for moving data, and which interaction shapes each one fits.

Part 8 Performance & transport

Reason about back-end I/O concurrency and HTTP/2-3 behavior behind the API.

  1. 18 Back-end I/O concurrency Serve many concurrent requests that each wait on I/O without exhausting threads: Quarkus blocking worker pools versus reactive and virtual threads, and Python's async event loop versus a thread pool under the GIL.
  2. 19 REST over HTTP/2 & HTTP/3 What changes for a REST API under the hood across HTTP versions: HTTP/2 multiplexing and HPACK, TCP head-of-line blocking, and HTTP/3 over QUIC with stream isolation, connection migration, and 0-RTT.

Part 9 Multi-protocol contracts & framework deep-dives

Go deep on OpenAPI, pair it with AsyncAPI, CloudEvents, and Arazzo under one shared schema, then dig into Quarkus REST and FastAPI internals.

  1. 20 OpenAPI in depth OpenAPI 3.1 schemas are JSON Schema: type-array nullability, a top-level webhooks section, and a structural drift check that keeps a served document matching the shared schema.
  2. 21 Multi-protocol contracts OpenAPI, AsyncAPI, CloudEvents and Arazzo compose around one shared JSON Schema, with Apicurio Registry and OpenMetadata as the governance tier behind that reuse.
  3. 22 Quarkus REST in depth Quarkus REST resolves parameter bindings at build time instead of by reflection, and a reactive Multi stream needs its own NDJSON writer to avoid double-encoding.
  4. 23 FastAPI in depth async def handlers run on FastAPI's event loop and plain def handlers run in a threadpool, and StreamingResponse and BackgroundTasks both depend on that dispatch model.

Part 10 Testing

Contract test the API and event schemas, run integration tests across both stacks, then automate with Newman and load testing.

  1. 24 Testing REST APIs A test pyramid for a REST API: contract tests against the shared schema, in-process integration tests in both stacks, Newman end-to-end checks and a bounded load layer, and which belong in CI.

Part 11 Running it: Docker โ†’ minikube โ†’ CRC

Run the booking API across three tiers: Docker/Podman Compose with LGTM tracing, Kubernetes on minikube, then OpenShift Local (CRC).

  1. 25 Local with Docker/Podman Compose Both stacks, Postgres and a single-container Grafana LGTM stack under Compose, with one booking's trace followed from the client's traceparent header to Tempo.
  2. 26 Kubernetes on minikube The same two booking images moved from Compose onto a cluster: Service and Ingress routing, three-tier health probes, ConfigMap and Secret injection, and a CPU-based HPA, assembled with kustomize.
  3. 99 OpenShift Local (CRC) The same two booking images on OpenShift Local: per-app Routes with edge TLS, an in-cluster BuildConfig and ImageStream build, restricted-v2 admission, and a Quarkus build failure traced to its root cause.

Part 12 Complete project

The shipping/cargo booking API end to end, every pattern from the book assembled into one both-stack project.

  1. 27 Complete project One booking service on both stacks that assembles contract-first resources, pagination, HATEOAS, async operations, versioning, soft delete, streaming and multi-protocol contracts into a single resource.