Svelte + FastAPI + PyCRDT Websocket
A collaborative web application that demonstrates real-time synchronization between clients using Conflict-free Replicated Data Types (CRDTs).
Tech Stack
- Frontend: Svelte with Yjs for CRDT implementation
- Backend: FastAPI with PyCRDT-Websocket for WebSocket communication
- Synchronization: Real-time data synchronization using the CRDT protocol
Features
- Real-time collaborative text editing
- Awareness of other connected users
- Works offline and handles synchronization when reconnecting
Getting Started
Prerequisites
- Python 3.8+ (preferably 3.13)
- Node.js or Bun
Setup
Run the setup script to install all dependencies:
chmod +x dev-setup.sh
./dev-setup.sh
This script will:
- Set up a Python virtual environment with required dependencies
- Initialize and build the Svelte frontend
- Configure the connection between frontend and backend
Running the Application
For the best experience, follow these steps:
- Build the frontend:
cd web
bun run build
- Run the backend server:
cd ../app
uv run fastapi dev main.py
- Open your browser at http://localhost:8000
License
MIT