A real-time collaborative code editor with AI-powered assistance. PocketBase handles auth + storage; FastAPI handles AI + Y.js CRDT sync; Caddy serves the React frontend. Designed to run on a single $6/month DigitalOcean droplet.
- Real-time multi-user editing with Y.js CRDTs (no merge conflicts)
- AI code analysis, optimization, and completions via OpenRouter
- Semantic search with LanceDB embedded vector store
- Email/password auth, workspaces, folders, documents, and chat
- Single-binary, single-droplet deployment
┌──────────────────────────────────────┐
users ── HTTPS │ Caddy (TLS, static, reverse proxy) │
│ / → React build │
│ /api/* → FastAPI :8000 │
│ /pb/* → PocketBase :8090 │
│ /ws/* → FastAPI :8000 │
└──────────────────────────────────────┘
- PocketBase — auth, SQLite DB, realtime subscriptions, admin UI.
- FastAPI — AI endpoints + Y.js CRDT WebSocket + LanceDB embeddings.
- React + Monaco — frontend served as static files by Caddy.
- Python 3.12+
- Node.js 18+
- (No PostgreSQL or Redis required — PocketBase replaces both for this app.)
# Download the binary for your platform from https://pocketbase.io/docs/
# Or run via Docker:
docker run --rm -p 8090:8090 \
-v "$(pwd)/pocketbase/pb_data:/pb/pb_data" \
-v "$(pwd)/pocketbase/pb_migrations:/pb/pb_migrations:ro" \
$(docker build -q ./pocketbase)Open http://127.0.0.1:8090/_/ and create the admin account on first boot.
cd backend
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
# Required env vars
export POCKETBASE_URL=http://127.0.0.1:8090
export OPENROUTER_API_KEY=sk-or-... # for AI analyze/optimize/complete
# Embeddings (optional; enables /api/ai/search)
export EMBEDDINGS_API_KEY=sk-or-...
export LANCE_DIR="$(pwd)/.lance"
uvicorn main:app --reload --port 8000cd frontend
npm install
npm run dev # http://localhost:8080Vite proxies aren't configured in dev — set VITE_API_BASE_URL and
VITE_PB_URL in a .env.local if your services run on non-default ports.
See deploy/README.md for the full droplet setup
(DigitalOcean $6 plan, Docker Compose, automatic HTTPS via Caddy).
CODESYNC/
├── deploy/ # Droplet deployment (compose, Caddyfile, env, README)
├── pocketbase/ # PocketBase Dockerfile + schema migrations
├── backend/ # FastAPI app — modular architecture
│ ├── main.py
│ └── app/
│ └── modules/ # one self-contained package per domain
│ ├── ai/ # router + schemas + pipeline/ (core, infra, operations)
│ ├── chat/ # router + chat_stream + retrieval/ (chunking, embeddings)
│ ├── collab/ # router (websocket) + yjs_manager
│ └── auth/ # pb_auth
├── frontend/ # React frontend — feature-based architecture
│ └── src/
│ ├── app/ # bootstrap: main.tsx, App.tsx, routing
│ ├── features/ # one folder per capability (components colocated)
│ │ ├── editor/ # CollaborativeEditor + theme/identity/statusbar
│ │ ├── ai-chat/ # chat panel, composer, message list
│ │ ├── ai-review/ # AI suggestions panel + cards
│ │ ├── files/ # file explorer + tree nodes
│ │ └── settings/ # settings modal
│ ├── shared/ # cross-cutting: ui/, lib/(api,pb,utils), stores/, hooks/, layout/
│ └── pages/ # route screens that compose features
└── docs/superpowers/specs/ # Design specs
- LLM: any OpenRouter-served model (default:
mistralai/devstral-small:free). - Embeddings: any OpenAI-compatible
/embeddingsprovider — defaults to OpenRouter's freenvidia/llama-nemotron-embed-vl-1b-v2:free. - All AI routes require a valid PocketBase JWT (verified by FastAPI).
MIT — see LICENSE.
Amitesh Gupta