← Docs

Recipe: Streaming HTTP response design

How Meridian streams license payloads and dashboard data with chunked transfer encoding.

Why stream

Large payloads block the event loop. Chunked Transfer-Encoding lets the client consume bytes before the server finishes serialization. Meridian uses this for auto-update manifests, license verification responses, and real-time dashboard feeds.

Server pattern

Set Transfer-Encoding: chunked. Write headers immediately, then flush each chunk. Use a ReadableStream or async generator piped through Response.

Client consumption

Use fetch with a ReadableStream reader. Process each chunk as it arrives — render progress, validate Ed25519 signatures incrementally, or hydrate dashboard widgets without waiting for the full payload.

Edge considerations

Vercel Edge Functions support streaming natively. Keep chunk sizes under 64 KB to avoid buffering. Set a circuit breaker on the client — if no chunk arrives within 30 seconds, abort and fall back to a cached response.