Storefront has been decoupled into micro-frontends with a dedicated commerce app and shared shell.

Read the architecture guide →

Contracts and Messaging

Owned APIs and events connect independently maintained BookWorm capabilities without sharing business state.

Cross-cutting Concept

Purpose and Scope

Contracts and messaging preserve service autonomy by preventing cross-service data access and making every interaction explicit. They govern synchronous APIs, AI and tool protocols, integration events, and the durability assumptions of asynchronous delivery across all capabilities.

Visual Reference

Contract and Delivery Pipeline

Loading graph...

Core Rules and Standards

  1. Keep data ownership local. No capability reads or writes another capability’s authoritative store.
  2. Use the owned contract. REST, gRPC, AI tool, agent, or event schemas belong to the owner and must describe stable externally visible behavior.
  3. Version compatibility explicitly. Prefer additive evolution and backward-compatible defaults; treat renaming or removing fields and changing semantics as breaking changes.
  4. Carry meaningful envelope metadata. Include message identity, event type and version, source, correlation, trace context, and causation where applicable.
  5. Treat delivery as at least once. Consumers must tolerate duplicates, retries, restart recovery, and out-of-order work unless a documented protocol provides stronger guarantees.
  6. Make side effects idempotent. Use stable operation or event identifiers to detect duplicate execution and verify authoritative state before compensating.
  7. Route exhausted work safely. Retry only bounded, classified failures and isolate poison or permanently invalid records for review.
Warning

Schema compatibility is necessary but not sufficient. A field-compatible change can still break a consumer if names, units, meaning, ordering, or ownership semantics change.

Mechanism / How It Works

Contract TypeStandardEvolution Rule
HTTPVersioned resources and explicit media behaviorAdd optional fields and endpoints; retire old behavior through a published transition
gRPCStable typed schemas and validated operationsUse schema compatibility checks and avoid renaming or repurposing fields
Agent and tool protocolsAuthenticated, least-privilege operations with machine-readable schemasChange permissions or tool behavior only through reviewed policy and consumer updates
Integration eventsImmutable intent, stable event identity, and self-contained enough data for consumersAdd fields without changing existing meaning; publish new event types for semantic changes

Messaging Pipeline

StageResponsibility
PublishValidate and serialize from the owner; assign message identity and correlation
TransportPreserve envelope metadata and delivery acknowledgement
PersistSelect outbox, inbox, or idempotency storage according to durability and duplicate needs
ConsumeValidate compatibility, enforce authorization, execute idempotently, and commit state atomically where possible
FailClassify transient, permanent, and poison failures; retry transient work; route exhausted work for inspection

Verification and Governance

  • Run consumer and provider contract checks before merging contract changes.
  • Verify additive and breaking schema changes against published baselines.
  • Test duplicate delivery, replay, missing metadata, partial commit, and exhausted retries.
  • Confirm production partitioning, retention, access, and replay ownership with the broker operator.
  • Document event semantics and business effects, not only payload shape.
  • API and contracts indexCustom DocAPI and contracts indexConsolidated index of BookWorm HTTP v1, gRPC, AG-UI, MCP, A2A, and Kafka/Wolverine contracts grouped by service with aut...Ownerplatform-engineering-teamOpen doc — Contract inventory.
  • Testing and Change SafetyCustom DocTesting and Change SafetyLayered tests and schema checks protect BookWorm behavior, service boundaries, and contract compatibility.Ownerarchitecture-enabling-teamOpen doc — Contract and compatibility gates.
  • Validation, Errors, and ResilienceCustom DocValidation, Errors, and ResilienceShared request validation, HTTP error mapping, and capability-specific retry and duplicate-request behavior.Ownerplatform-engineering-teamOpen doc — Failure and retry standards.