{"name":"yjs-cf-ws-provider: A Yjs WebSocket Provider on Cloudflare Workers","description":"The yjs-cf-ws-provider project offers a serverless WebSocket provider for Yjs, leveraging Cloudflare Workers and Durable Objects. It is designed for learning and demonstrating Cloudflare's powerful APIs, providing a cost-effective and scalable solution for real-time collaboration. This provider is fully compatible with the Yjs WebSocket Connector.","github":"https://github.com/TimoWilhelm/yjs-cf-ws-provider","url":"https://osrepos.com/repo/timowilhelm-yjs-cf-ws-provider","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/timowilhelm-yjs-cf-ws-provider","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/timowilhelm-yjs-cf-ws-provider.md","json":"https://osrepos.com/repo/timowilhelm-yjs-cf-ws-provider.json","topics":["TypeScript","Cloudflare","WebSocket","Yjs","Serverless","Durable Objects","Realtime","Collaboration"],"keywords":["TypeScript","Cloudflare","WebSocket","Yjs","Serverless","Durable Objects","Realtime","Collaboration"],"stars":null,"summary":"The yjs-cf-ws-provider project offers a serverless WebSocket provider for Yjs, leveraging Cloudflare Workers and Durable Objects. It is designed for learning and demonstrating Cloudflare's powerful APIs, providing a cost-effective and scalable solution for real-time collaboration. This provider is fully compatible with the Yjs WebSocket Connector.","content":"## Introduction\n\nThe `yjs-cf-ws-provider` project offers a serverless WebSocket provider specifically designed for Yjs, running efficiently on Cloudflare Workers. It utilizes Cloudflare Durable Objects to manage state and relay messages between clients, ensuring robust real-time synchronization. A notable feature is its use of the Cloudflare Durable Objects WebSocket Hibernation API, which terminates idle WebSocket connections to minimize duration charges. Additionally, it periodically saves Yjs document states to Cloudflare R2 storage, clearing partial updates from Durable Object storage to optimize performance and cost. This provider is fully compatible with the official Yjs WebSocket Connector.\n\nPlease note, this project is primarily intended for learning purposes and to demonstrate the capabilities of Cloudflare Workers and Durable Objects APIs. For production-ready solutions, consider alternatives like [PartyKit](https://docs.partykit.io/guides/deploy-to-cloudflare/){:target=\"_blank\"}, which also supports the Yjs API.\n\n## Installation\n\nTo run this project locally, follow these steps:\n\nbash\nnpm install\nnpm run dev\n\n\nThis command will start a local server using the Wrangler CLI and serve a demo application. You can then open a browser to the URL displayed in the console to test it with a simple [TipTap](https://tiptap.dev/){:target=\"_blank\"} editor.\n\n## Examples\n\nThe local development setup includes a demo application, allowing you to easily test the provider with a basic TipTap editor in your browser. This provides a practical example of how the Yjs WebSocket provider integrates with a collaborative text editor.\n\n## Why Use It\n\n*   **Serverless & Scalable**: Leveraging Cloudflare Workers and Durable Objects, this provider offers a highly scalable and serverless solution for Yjs real-time collaboration.\n*   **Cost-Effective**: The innovative use of WebSocket Hibernation significantly reduces operational costs by preventing charges for idle connections.\n*   **Data Persistence**: Integration with Cloudflare R2 ensures that Yjs document states are persistently stored and regularly optimized.\n*   **Educational Value**: It serves as an excellent resource for developers looking to understand and implement Cloudflare's powerful serverless and state management APIs.\n*   **Yjs Ecosystem**: Its full compatibility with the [Yjs WebSocket Connector](https://github.com/yjs/y-websocket){:target=\"_blank\"} makes it a seamless fit within existing Yjs-based applications.\n\n## Links\n\n*   [GitHub Repository](https://github.com/TimoWilhelm/yjs-cf-ws-provider){:target=\"_blank\"}\n*   [Deploy to Cloudflare](https://deploy.workers.cloudflare.com/?url=https://github.com/TimoWilhelm/yjs-cf-ws-provider){:target=\"_blank\"}\n*   [PartyKit](https://docs.partykit.io/guides/deploy-to-cloudflare/){:target=\"_blank\"}\n*   [Yjs WebSocket Connector](https://github.com/yjs/y-websocket){:target=\"_blank\"}\n*   [TipTap](https://tiptap.dev/){:target=\"_blank\"}","metrics":{"detailViews":3,"githubClicks":11},"dates":{"published":null,"modified":"2026-01-26T20:01:00.000Z"}}