{"by":"brian_meek","descendants":35,"id":45421221,"kids":[45423605,45424967,45424460,45426354,45422684,45424425,45423660,45423874],"score":52,"text":"Last week Cloudflare released Cap&#x27;n Web [1], a schema-free capability-based RPC protocol. I built capn-rs this week - a Rust implementation with full wire protocol compatibility.\nLinks:<p>GitHub: <a href=\"https:&#x2F;&#x2F;github.com&#x2F;currentspace&#x2F;capn-rs\" rel=\"nofollow\">https:&#x2F;&#x2F;github.com&#x2F;currentspace&#x2F;capn-rs</a>\nCrates: <a href=\"https:&#x2F;&#x2F;crates.io&#x2F;crates&#x2F;capnweb-server\" rel=\"nofollow\">https:&#x2F;&#x2F;crates.io&#x2F;crates&#x2F;capnweb-server</a>\nAPI docs: <a href=\"https:&#x2F;&#x2F;docs.rs&#x2F;capnweb-server\" rel=\"nofollow\">https:&#x2F;&#x2F;docs.rs&#x2F;capnweb-server</a><p>What&#x27;s working:<p>Wire compatibility verified via integration tests against TypeScript reference\nMulti-transport: HTTP batch, WebSocket, WebTransport (HTTP&#x2F;3)\nComplete IL (intermediate language) expression evaluator\nPromise pipelining with dependency resolution\nComprehensive test coverage<p>The interesting design challenge was mapping Cap&#x27;n Web&#x27;s record-replay .map() semantics to Rust&#x27;s type system while maintaining ergonomic APIs. Cap&#x27;n Web records operations on placeholder values to build execution plans - in Rust this became a clean builder pattern with type-level guarantees.\nBuilt this as an experiment with Claude Code for porting complex protocols. The AI handled mechanical translation well, but architectural decisions (especially around async&#x2F;await patterns and lifetime management) required human judgment.\nThis is early days - I&#x27;d especially appreciate feedback on API ergonomics and any edge cases I might have missed. Also happy to discuss the protocol design or the AI-assisted development experience.<p>[1] <a href=\"https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=45332883\">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=45332883</a>","time":1759198380,"title":"Show HN: Cap'n-rs – Rust implementation of Cloudflare's Cap'n Web protocol","type":"story","url":"https://github.com/currentspace/capn-rs"}