Production readiness checklist for durable streams. Switch from dev server to Caddy binary, configure CDN caching with offset-based URLs, Cache-Control and ETag headers, Stream-Cursor for cache collision prevention, TTL and Stream-Expires-At for stream lifecycle, HTTPS requirement, request collapsing for fan-out, CORS configuration. Load before deploying durable streams to production.
This skill builds on durable-streams/server-deployment. Read it first for server setup basics.
Run through each section before deploying to production.
Expected:
./durable-streams-server run --config Caddyfile
Fail condition: Importing DurableStreamTestServer from @durable-streams/server in production code.
Fix: Download the Caddy binary from GitHub releases and configure with a Caddyfile.
Expected:
durable_streams {
data_dir ./data
max_file_handles 200
}
Fail condition: No data_dir in Caddyfile — server uses in-memory storage and loses data on restart.
Fix: Add data_dir pointing to a persistent directory.
Expected:
const res = await stream({
url: "https://your-server.com/v1/stream/my-stream",
})
Fail condition: Using http:// URLs in production. Pre-signed URLs and auth tokens are bearer credentials — HTTP exposes them in transit. HTTP/1.1 also limits browsers to ~6 concurrent connections per origin.
Fix: Configure TLS on the Caddy server (Caddy provides automatic HTTPS by default).
Expected:
const handle = await DurableStream.create({
url: "https://server.com/v1/stream/my-stream",
contentType: "application/json",
headers: { "Stream-TTL": "86400" }, // 24 hours
})
Fail condition: Streams created without TTL persist forever, causing unbounded storage growth.
Fix: Set Stream-TTL (seconds) or Stream-Expires-At (ISO timestamp) on stream creation. Use exactly one, not both.
Expected: