Overview of the Worker-React example architecture
mainThis example demonstrates a full-stack Cap'n Web implementation:
- Server: A Cloudflare Worker exposing a Cap'n Web API at the
/apiendpoint (server/worker.ts). It uses@validateRpc()for server-boundary runtime validation. - Client: A React/Vite application (
client/) that uses Cap'n Web client sessions wrapped withvalidateStub()for explicit client stub validation. - Validation:
wrangler.jsoncis configured to runcapnweb-validate buildbefore starting. Worker validation output is located at.wrangler/validate/worker.ts.