Cap'n Web is a JavaScript-native RPC system that implements an object-capability protocol without requiring schemas or boilerplate.
The tool solves the problem of building efficient, expressive RPC systems for the web by adopting the object-capability model from Cap'n Proto but removing the schema requirement entirely. It works like the JavaScript-native RPC system in Cloudflare Workers, using JSON as its serialization format with minimal preprocessing. The approach enables bidirectional calling, passing functions and objects by reference, promise pipelining to chain dependent calls into a single network round trip, and capability-based security where holding a reference grants permission to use it. This design allows developers to write RPC code with almost no boilerplate while maintaining type safety through TypeScript integration.
Cap'n Web suits projects where you want RPC expressiveness without the overhead of schema definition and code generation. It works across all major browsers, Cloudflare Workers, Node.js, Bun, Deno, and other modern JavaScript runtimes, and supports HTTP, WebSocket, and postMessage transports out of the box. The tool compresses to under 16 kilobytes with no dependencies, making it lightweight for browser environments. The README compares it against tRPC, JSON-RPC, GraphQL, and Cap'n Proto, positioning it as more expressive than most other RPC systems due to its object-capability model while being simpler than Cap'n Proto for web use cases.
The project receives issues from both core team members and outside users, indicating adoption beyond the maintainers without an overwhelming external support burden. Maintainers typically respond to new issues and pull requests within a day. Work in the issue tracker is dominated by enhancement, documentation, and large-scope items.