Inspiration: VS Code Live Share routes traffic through their servers. We wanted true peer-to-peer collaboration, no middleman.

What it does: PearCollab is a VS Code extension for real-time peer-to-peer collaborative editing. Share a room name, your peer joins, and you edit a folder together with live cursors, selections, and all changes synced instantly, without your data going through central servers.

How we built it: VS Code extension (TypeScript) + a Node.js sidecar process. Hyperswarm handles P2P discovery and connection over the DHT network. Yjs CRDTs handle conflict-free concurrent edits. The extension talks to the sidecar via JSON-RPC over stdio. Hyperswarm employs end-to-end encryption on the communication channels.

Challenges we ran into: Keeping VS Code's editor state in sync with Yjs was the hardest part. Remote edits arrive async, so two deltas could race and corrupt offsets. We also had to ref-count edit suppression to avoid loopback, so when we apply a remote edit to VS Code, the document-change event must not re-broadcast it back. Figuring out that the university network was blocking Hyperswarm peer discovery was another challenge.

Accomplishments that we're proud of: Resolving the P2P blockage by working across different networks (hotspot + university WiFi). The CRDT merge handles concurrent edits (mostly) correctly.

What we learned: Yjs deltas must be applied serially against the exact document state they were computed on. Async VS Code APIs and CRDT event observers are a subtle combination.

What's next for PearCollab: Stable document edits, shared terminal, execution and debugging.

Built With

Share this project:

Updates