every.channel/evolution/proposals/ECP-0048-bootstrap-api-via-containers.md
2026-02-15 16:17:27 -05:00

36 lines
1.5 KiB
Markdown

# ECP-0048: Bootstrap WebRTC Directory API via Cloudflare Containers
## Why
The website at `every.channel` is static, but we still need a minimal rendezvous surface so browsers can:
- see a public list of live streams, and
- exchange WebRTC offers/answers without copy/paste.
We already have a `/api/*` shape (ECP-0046). The intent is explicitly limited: **bootstrap WebRTC only**.
Using a Container lets us serve those endpoints from a normal Rust HTTP server (portable, no Workers-specific runtime),
while keeping the main site static and keeping the surface area small.
## Proposal
Keep the public `/api/*` endpoints, but implement them as:
- a single named Cloudflare Container instance (`global`) running a tiny Rust server; and
- a Worker Durable Object wrapper (implemented via `@cloudflare/containers`) that forwards `/api/*` requests into the container on port `8080`.
Endpoints (unchanged):
- `GET /api/health`
- `GET /api/directory`
- `POST /api/announce` `{stream_id,title,offer,expires_ms?}`
- `POST /api/answer` `{stream_id,answer}`
- `GET /api/answer?stream_id=...` (one-shot consume)
Constraints:
- TTL + size caps.
- No additional API endpoints.
- Container internet egress disabled.
- This is not spam-resistant or censorship-resistant; it is an interim bootstrap.
## Reversibility
High. The website and node code depend on the `/api/*` shape, not the backing implementation.
We can replace this with a decentralized rendezvous or native browser transport later.