cloudflare/partykit

PartyKit, for Workers

What it solves

PartyServer provides a set of libraries and examples for building real-time, collaborative applications using Cloudflare Workers and Durable Objects. It simplifies the complexity of managing WebSockets, state synchronization, and collaborative editing at scale.

How it works

The project consists of several specialized packages:

  • PartyServer: The core library that enhances Durable Objects to simplify WebSocket management, broadcasting, and lifecycle hooks.
  • PartySocket: A client-side library that handles WebSocket reconnections, buffering, and resilience.
  • Y-PartyServer: Integrates Yjs (a CRDT library) to enable real-time collaborative editing with hooks for external storage.
  • partysub: A pubsub system that scales rooms across multiple Durable Object instances and global locations.
  • partysync: An experimental tool for synchronizing state from a Durable Object to a client.
  • partywhen: A library for scheduling tasks at scale.
  • hono-party: Middleware for the Hono framework to handle PartyServer requests.

Who it’s for

Developers building real-time apps, collaborative tools, and scalable WebSocket-based services on the Cloudflare Workers platform.

Highlights

  • CRDT Support: Built-in support for Yjs for seamless collaborative editing.
  • Scalable PubSub: Ability to spread load across multiple Durable Object instances globally.
  • Resilient Connections: Client-side buffering and automatic reconnections via PartySocket.
  • Cloudflare Native: Specifically optimized for Cloudflare Workers and Durable Objects.

Related

  • Project
  • Project
  • Project
  • Project
  • Project