HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
cloudflare
capnweb
TypeScript2025–2025
cloudflare / capnweb

capnweb

JavaScript/TypeScript-native, low-boilerplate, object-capability RPC system

8Distinct people
9Mentions
1Explicit recommenders
4KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

JavaScript/TypeScript-native, low-boilerplate, object-capability RPC system

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

If you have ever had to use gRPC & web, then you will know how painful Protobuf is to make it work on the web. I love the simplicity of Cap'n Web…

srameshc used a recommendation phrase. One indexed comment matches. This is a phrase match, not a verdict.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 12:54:37 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by day9 dated mentions

Observed mentions: 2025-09-22 14:19:04 UTC to 2025-09-30 15:01:15 UTC.

0123452025-09-22 00:00:00 UTC to 2025-09-23 00:00:00 UTC (exclusive): 5 mentions; 1 submissions, 4 commentsSep 222025-09-23 00:00:00 UTC to 2025-09-24 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2025-09-24 00:00:00 UTC to 2025-09-25 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-09-25 00:00:00 UTC to 2025-09-26 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-09-26 00:00:00 UTC to 2025-09-27 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 commentsSep 262025-09-27 00:00:00 UTC to 2025-09-28 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-09-28 00:00:00 UTC to 2025-09-29 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-09-29 00:00:00 UTC to 2025-09-30 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-09-30 00:00:00 UTC to 2025-10-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 commentsSep 30

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Sep 222025-09-22 00:00:00 UTC2025-09-23 00:00:00 UTC514
Sep 232025-09-23 00:00:00 UTC2025-09-24 00:00:00 UTC101
Sep 242025-09-24 00:00:00 UTC2025-09-25 00:00:00 UTC000
Sep 252025-09-25 00:00:00 UTC2025-09-26 00:00:00 UTC000
Sep 262025-09-26 00:00:00 UTC2025-09-27 00:00:00 UTC000
Sep 272025-09-27 00:00:00 UTC2025-09-28 00:00:00 UTC000
Sep 282025-09-28 00:00:00 UTC2025-09-29 00:00:00 UTC000
Sep 292025-09-29 00:00:00 UTC2025-09-30 00:00:00 UTC000
Sep 302025-09-30 00:00:00 UTC2025-10-01 00:00:00 UTC303

What Hacker News says

9 sources
OP here. Thanks for all the thoughtful feedback, I really appreciate it. I mentioned in the README that I leaned heavily on Claude Opus for the port. One of the biggest challenges was tamping down its default “everything is production-ready in a week” optimism. That said, I also discovered along the way which guardrails worked and which didn’t for guiding it toward a compliant implementation. It was good learning, and honestly, fun. I’m genuinely interested in the Cap’n Web protocol. Writing this in Rust gave me a much clearer sense of where I would and wouldn’t use it. Credit to the Cloudflare team for defining the protocol and shipping a solid reference implementation, this wouldn’t have been possible otherwise. A good example of why a second client (even one bootstrapped with AI) is useful: in implementation I ran into a spec ambiguity
Read the rest
around array escaping (documented here: https://github.com/cloudflare/capnweb/issues/68 ). My initial Rust serializer emitted unescaped arrays at lower levels, and I even patched the TS reference to accept them. In the end, escaping arrays at all levels turned out to be the cleaner and more consistent approach, so I’ve recommended that clarification in the issue. On naming: fair point about possible confusion with Cap’n Proto. If the Cloudflare team ever wants the crate names for an official Rust impl, they’re theirs. If there’s interest in pushing this to production ready quality, I’d also be glad to put in the work. Thanks again for the constructive input. Happy to dive into technical details if folks are curious.
In Show HN: Cap'n-rs – Rust implementation of Cloudflare's Cap'n Web protocol
srameshc·Sep 23, 2025Recommendation phrase
If you have ever had to use gRPC & web, then you will know how painful Protobuf is to make it work on the web. I love the simplicity of Cap'n Web https://capnproto.org/language.html , hopefully this will lead us to better and easier RPC. Update: Unlike Cap'n Proto, Cap'n Web has no schemas. In fact, it has almost no boilerplate whatsoever. This means it works more like the JavaScript-native RPC system in Cloudflare Workers. https://github.com/cloudflare/capnweb
In Cap'n Web: a new RPC system for browsers and web servers
> your function needs to have no side effects I'm trying to understand how well this no-side-effects footgun is defended against. https://github.com/cloudflare/capnweb/blob/main/src/map.ts#L... seems to indicate that if the special pre-results "record mode" call of the callback raises an error, the library silently bails out (but keeps anything already recorded, if this was a nested loop). That catches a huge number of things like conditionals on `item.foo` in the map, but (a) it's quite conservative and will fail quite often with things like those conditionals, and (b) if I had `count += 1` in my callback, where count was defined outside the scope, now that's been incremented one extra time, and it didn't raise an error. React Hooks had a similar problem, with a constraint that hooks couldn't be called conditionally. But they solved thei
Read the rest
r DX by having a convention where every hook would start with `use`, so they could then build linters that would enforce their constraint. And if I recall, their rules-of-hooks eslint plugin was available within days of their announcement. The problem with `map` is that there are millions of codebases that already use a method called `map`. I'd really, really love to see Cap'n Web use a different method name - perhaps something like `smartMap` or `quickMap` or `rpcMap` - that is more linter-friendly. A method name that doesn't require the linter to have access to strong typing information, to understand that you're mapping over the special RpcPromise rather than a low-level array. Honestly, it's a really cool engineering solve, with the constraint of not having access to the AST like one has in Python. I do think that with wider adoption, people will find footguns, and I'd like this software to get a reputation for being resilient to those!
In Cap'n Web: a new RPC system for browsers and web servers
Here is the Cap'n Proto RPC protocol: https://github.com/capnproto/capnproto/blob/v2/c%2B%2B/src/c... That's just the RPC state machine -- the serialization is specified elsewhere, and the state machine is actually schema-agnostic. (Schemas are applied at the edges, when messages are actually received from the app or delivered to it.) This is the Cap'n Web protocol, including serialization details: https://github.com/cloudflare/capnweb/blob/main/protocol.md Now, to be fair, Cap'n Proto has a lot of features that Cap'n Web doesn't have yet. But Cap'n Web's high-level design is actually a lot simpler. Among other things, I merged the concepts of call-return and promise-resolve. (Which, admittedly, CapTP was doing it that way before I even designed Cap'n Proto. It was a complete mistake on my part to turn them into two separate concepts in C
Read the rest
ap'n Proto, but it seemed to make sense at the time.) What I'd like to do is go back and revise the Cap'n Proto protocol to use a similar design under the hood. This would make no visible difference to applications (they'd still use schemas), but the state machine would be much simpler, and easier to port to more languages.
In Cap'n Web: a new RPC system for browsers and web servers
I see that it supports websockets for the transport layer, is there any support for two way communication? edit: was skimming the github repo https://github.com/cloudflare/capnweb/tree/main?tab=readme-o... and saw this which answers my question: > Supports passing functions by reference: If you pass a function over RPC, the recipient receives a "stub". When they call the stub, they actually make an RPC back to you, invoking the function where it was created. This is how bidirectional calling happens: the client passes a callback to the server, and then the server can call it later. > Similarly, supports passing objects by reference: If a class extends the special marker type RpcTarget, then instances of that class are passed by reference, with method calls calling back to the location where the object was created. Gonna skim some more to
Read the rest
see if i can find some example code.
In Cap'n Web: a new RPC system for browsers and web servers
This looks pretty awesome, and excited it's not only a cloudflare product (Cap'n Web exists alongside cloudflare Workers). Reading this section [1], can you say more about: > as of this writing, the feature set is not exactly the same between the two. We aim to fix this over time, by adding missing features to both sides until they match. do you think once the two reach parity, that that parity will remain, or more likely that Cap'n Web will trail cloudflare workers, and if so, by what length of time? [1] https://github.com/cloudflare/capnweb/tree/main?tab=readme-o...
In Cap'n Web: a new RPC system for browsers and web servers

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.