Backend Client Standard

Backend integration uses centralized transports and feature-scoped semantic clients. This is an application-client capability, not an activity or web requirement. Web, native, CLI, worker, and local tools may adopt it.

default_backend_integration_standard

Returns the centralized backend-client capability rules.

render_backend_integration_standard

Renders the backend-integration capability as text or JSON.

Layering

  1. Generated contract projections own wire shapes and boundary decoding.
  2. Shared transports own URLs, headers, credentials, deadlines, retries, streams, and sockets.
  3. Feature clients expose semantic operations in domain language.
  4. Stores own feature state and authoritative snapshot application.
  5. Workflows compose operations and cancellation.
  6. Components render state and report user intent.

Transport Selection

TransportUseAvoid when
HTTPFinite commands, queries, snapshots, uploadsBoth peers need ongoing messages
SSEServer progress and event streams with browser reconnectionThe client must send stream messages
WebSocketBidirectional or latency-sensitive protocolsRequest/response or one-way events are sufficient
PollingSimple infrequent status refreshLatency or request volume makes it wasteful

Request Policy

Streaming Policy

A stream defines protocol version, event identity, ordering, correlation, replay or resume token, heartbeat, backpressure behavior, reconnect/backoff, terminal events, cancellation, and authoritative resynchronization. A queryable snapshot is the recovery authority after missed or invalid events.

Local Applications

Loopback HTTP does not imply trust. Local web applications document origin allowlists, authentication or capability tokens, CSRF posture, port discovery, protocol versions, process ownership, startup readiness, and shutdown behavior. Native IPC may implement the same semantic-client interface without leaking its transport into workflows.

Audit Boundary

Dev-std validates declared transport, feature, source, and signoff paths. Project lint validates forbidden raw transport construction and dependency direction. Tests exercise normalized failures, cancellation, retries, reconnect, resynchronization, and protocol-version mismatch.

Executable Evidence

The canonical implementation evidence lives in docs/templates/web/lit-activity/src/transport/ and the feature-scoped project client. It demonstrates a replaceable demo/HTTP transport boundary without allowing activities or views to construct raw network requests. Clean-copy validation and maintainer commands are documented in Build Documentation.