https://github.com/leisurelyleon/cosync
Real-time collaborative editor — multiple users edit a shared document live, with presence (who's online + live cursors). Rust WebSocket server (axum/tokio) holds authoritative room state and broadcasts ordered edits; Next.js/TypeScript frontend. Backend on Fly.io, frontend on Vercel.
https://github.com/leisurelyleon/cosync
backend broadcast editor flyio frontend nextjs rust typescript vercel websocket
Last synced: about 2 hours ago
JSON representation
Real-time collaborative editor — multiple users edit a shared document live, with presence (who's online + live cursors). Rust WebSocket server (axum/tokio) holds authoritative room state and broadcasts ordered edits; Next.js/TypeScript frontend. Backend on Fly.io, frontend on Vercel.
- Host: GitHub
- URL: https://github.com/leisurelyleon/cosync
- Owner: leisurelyleon
- License: mit
- Created: 2026-06-03T04:24:15.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2026-06-03T06:18:37.000Z (about 1 month ago)
- Last Synced: 2026-06-03T06:18:44.081Z (about 1 month ago)
- Topics: backend, broadcast, editor, flyio, frontend, nextjs, rust, typescript, vercel, websocket
- Language: TypeScript
- Homepage:
- Size: 43.9 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cosync
A **real-time collaborative editor**. Multiple users join a room, edit a shared
document, and see each other's changes live — with presence showing who's
connected. The Rust server holds the authoritative document and broadcasts
ordered edits to everyone in the room.
## How it works
- **Authoritative WebSocket server** (Rust, axum + tokio). Each room owns its
document and a broadcast channel; edits are applied server-side and fanned out
to all participants. (ADR 0001)
- **Direct WebSocket connection.** The browser connects straight to the server via
`NEXT_PUBLIC_WS_URL` — Next.js rewrites can't proxy WebSocket upgrades. (ADR 0002)
- **Presence.** Participants get a color and appear in a live roster; joins and
leaves broadcast to the room. (ADR 0003)
## Layout
| Path | What it is |
|------------------------|-----------------------------------------|
| `crates/cosync-server` | Rust WebSocket server |
| `web/` | Next.js frontend |
| `docs/` | Architecture + ADRs |
## Develop
Prerequisites: Rust and Node 20+. (A `.devcontainer` ships both.)
```bash
# Server (listens on :8080)
cargo run -p cosync-server
# Frontend, in another terminal
cd web
npm install
# point the client at the server:
echo "NEXT_PUBLIC_WS_URL=ws://localhost:8080" > .env.local
npm run dev # http://localhost:3000
```
Open the page in two tabs — type in one, watch it sync to the other.
## Deploy
- **Server** -> Fly.io (always-on; WebSockets need a persistent machine).
- **Frontend** -> Vercel, Root Directory = `web`, with `NEXT_PUBLIC_WS_URL` set to
the `wss://` Fly URL.
## Status
- [x] Authoritative WebSocket server
- [x] Live document sync + presence
- [x] Deployed (Fly.io + Vercel)
- [x] Live cursors / CRDT merge (ADR 0003)