# cloudflare/capnweb

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/cloudflare-capnweb).**

3,846 stars · 134 forks · TypeScript · MIT

## Links

- GitHub: https://github.com/cloudflare/capnweb
- awesome-repositories: https://awesome-repositories.com/repository/cloudflare-capnweb.md

## Description

Capnweb is a distributed object communication library and Cap'n Proto RPC framework. It enables type-safe remote procedure calls between clients and servers using shared schemas and generated stubs to invoke methods on remote objects as if they were local.

The project utilizes an object-capability security model to govern access to remote resources through unforgeable tokens. It provides a bidirectional network layer that multiplexes asynchronous calls and data streams over persistent WebSocket connections and includes a remote resource lifecycle manager that uses reference counting to automate the disposal of distributed objects.

The framework supports bidirectional data streaming with flow control and backpressure, along with request batching and promise pipelining to reduce network round trips. It also allows for custom transport implementations and provides connection health monitoring to track remote connection failures.

## Tags

### Networking & Communication

- [RPC Frameworks](https://awesome-repositories.com/f/networking-communication/rpc-frameworks.md) — Provides a high-performance framework for executing type-safe remote procedures across network nodes using shared schemas.
- [Cap'n Proto RPC Implementations](https://awesome-repositories.com/f/networking-communication/cap-n-proto-rpc-implementations.md) — Provides a communication system for type-safe remote procedure calls and distributed object interaction based on Cap'n Proto.
- [Stream Multiplexing](https://awesome-repositories.com/f/networking-communication/peer-to-peer-streaming/stream-multiplexing.md) — Implements techniques for running multiple independent data streams over a single physical network connection.
- [Schema-Based Server Generation](https://awesome-repositories.com/f/networking-communication/rpc-servers/schema-based-server-generation.md) — Automatically generates client and server stubs from shared service schemas to enforce strict type contracts.
- [High-Performance Networking](https://awesome-repositories.com/f/networking-communication/high-performance-networking.md) — Reduces network latency and overhead by multiplexing data streams and batching requests over persistent connections.
- [Promise-Based Batching](https://awesome-repositories.com/f/networking-communication/remote-procedure-calls/promise-based-batching.md) — Groups dependent remote procedure calls into a single network request to reduce round-trip latency.
- [RPC Call Batching](https://awesome-repositories.com/f/networking-communication/remote-procedure-calls/rpc-call-batching.md) — Groups multiple remote procedure calls into a single network request to reduce latency and improve efficiency. ([source](https://cdn.jsdelivr.net/gh/cloudflare/capnweb@main/README.md))
- [Promise Pipelining](https://awesome-repositories.com/f/networking-communication/remote-promise-messaging/promise-pipelining.md) — Reduces network round trips by chaining dependent remote procedure calls together via promise pipelining. ([source](https://cdn.jsdelivr.net/gh/cloudflare/capnweb@main/README.md))

### Data & Databases

- [Resource Lifecycle Managers](https://awesome-repositories.com/f/data-databases/resource-management/resource-lifecycle-managers.md) — Provides a system for predictable allocation and automated cleanup of distributed resources to prevent memory leaks.
- [Bidirectional Multiplexing](https://awesome-repositories.com/f/data-databases/typed-data-collections/sequence-management/asynchronous-streams/multiplexed-message-streams/bidirectional-multiplexing.md) — Routes asynchronous data streams and procedure calls between distinct execution contexts using a shared message bus.

### Development Tools & Productivity

- [Flow Control](https://awesome-repositories.com/f/development-tools-productivity/plugin-management/backpressure-management/flow-control.md) — Employs backpressure and flow-control mechanisms to manage bidirectional data streaming and prevent memory overflow. ([source](https://cdn.jsdelivr.net/gh/cloudflare/capnweb@main/README.md))
- [Remote Stub Disposal](https://awesome-repositories.com/f/development-tools-productivity/remote-resource-management-tools/remote-stub-disposal.md) — Manages the lifecycle of remote stubs to trigger server-side resource reclamation once all references are released. ([source](https://cdn.jsdelivr.net/gh/cloudflare/capnweb@main/README.md))

### Programming Languages & Runtimes

- [Value Serialization](https://awesome-repositories.com/f/programming-languages-runtimes/value-serialization.md) — Implements mechanisms for marshalling primitives and plain objects into binary buffers for network transfer. ([source](https://cdn.jsdelivr.net/gh/cloudflare/capnweb@main/README.md))

### Security & Cryptography

- [Capability-Based Access Controls](https://awesome-repositories.com/f/security-cryptography/capability-based-access-controls.md) — Governs access to remote resources using unforgeable tokens and object-capability-based authorization.
- [Object Capability Models](https://awesome-repositories.com/f/security-cryptography/security/policies/capability-authorization/capability-based-security/reference-capability-type-systems/object-capability-models.md) — Implements a security model where every object reference carries a capability defining the allowed operations.

### Software Engineering & Architecture

- [Shared Object Abstractions](https://awesome-repositories.com/f/software-engineering-architecture/distributed-object-handles/distributed-object-identifiers/shared-object-abstractions.md) — Implements shared object abstractions that allow developers to interact with distributed data structures as if they were local.
- [Reference Counting Mechanisms](https://awesome-repositories.com/f/software-engineering-architecture/object-reference-mapping/reference-counting-mechanisms.md) — Uses reference counting to track remote object ownership and automate memory reclamation when references are released.
- [Remote Object Stubs](https://awesome-repositories.com/f/software-engineering-architecture/remote-object-stubs.md) — Provides remote stubs that allow class instances to be shared and invoked across the network without serializing the entire object. ([source](https://cdn.jsdelivr.net/gh/cloudflare/capnweb@main/README.md))
- [Remote Value Transformations](https://awesome-repositories.com/f/software-engineering-architecture/code-transformation-tools/callback-driven-replacements/data-value-transformations/remote-value-transformations.md) — Allows executing server-side callbacks to modify values before transmission, minimizing the amount of data transferred over the network. ([source](https://cdn.jsdelivr.net/gh/cloudflare/capnweb@main/README.md))

### Web Development

- [RPC Over WebSocket](https://awesome-repositories.com/f/web-development/websockets/rpc-over-websocket.md) — Enables bidirectional, asynchronous remote procedure calls over persistent WebSocket connections. ([source](https://cdn.jsdelivr.net/gh/cloudflare/capnweb@main/README.md))
- [Bidirectional Streams](https://awesome-repositories.com/f/web-development/real-time-data-streaming/bidirectional-streams.md) — Supports full-duplex message exchange with flow control and backpressure for high-volume data streaming.
