Google Docs collaboration, VS Code editing, and GitHub-style project ownership in one real-time coding workspace.
CollabCode is a full-stack collaborative editor built with FastAPI, React, Monaco, Yjs, Redis, and PostgreSQL. Users sign in, create persistent projects, edit multiple files, share file links with other signed-in users, and collaborate live with cursor presence, autosave, and conflict-free CRDT sync.
Most collaborative editor demos stop at “multiple users can type in the same text box.” This project goes further:
- authenticated users instead of anonymous room links
- persistent projects and files instead of ephemeral sessions
- file-based collaboration on top of a project model
- real WebSocket state sync backed by Redis pub/sub
- CRDT conflict resolution with Yjs
- production-minded features like reconnection handling, password reset, project deletion, metrics, and Dockerized local infrastructure
This is the product model:
Users -> Projects -> Files -> Real-time collaboration per file
Not:
Anonymous users -> temporary rooms
- Email/password authentication with per-tab sessions
- Forgot password flow with reset tokens
- Persistent projects owned by users
- Multi-file editing inside each project
- Shareable file links for other signed-in users
- Live cursor and selection presence
- Conflict-free concurrent editing with Yjs CRDT
- Monaco editor with Python, JavaScript, and C++ support
- Code execution panel for supported languages
- Project deletion
- Prometheus metrics and Grafana dashboards
- Docker Compose setup for the full stack
- Frontend:
React,TypeScript,Vite,Monaco Editor,Yjs - Backend:
Python,FastAPI,SQLAlchemy,asyncpg - Real-time:
WebSockets,Redis pub/sub - Persistence:
PostgreSQL - Monitoring:
Prometheus,Grafana - Load testing scaffold:
Locust
Users register, log in, reset passwords, and receive bearer tokens for authenticated API and WebSocket access.
Projects are persistent collaborative workspaces. Each project has:
- an owner
- member access records
- one or more code files
Each file is a collaborative document with:
- a language
- a persisted Yjs snapshot
- shareable URL
- collaborative presence and live editing state
The current sharing mode is:
- any signed-in user with a shared file link can join the project via that file
This keeps the UX simple while still feeling closer to Docs or GitHub than a temporary room model.
React + Monaco + Yjs client
|
| REST: auth, projects, files, execution
| WebSocket: live file collaboration
v
FastAPI application
|
+--> Auth service
+--> Project/file service
+--> Collaboration manager
+--> Code execution service
|
+--> Redis pub/sub for cross-instance sync
+--> PostgreSQL for users, projects, files, memberships, snapshots
+--> Prometheus metrics
|
v
Grafana
Main entities:
usersprojectsproject_membersfilesfile_snapshots
High-level relationships:
User 1---* Project (owner)
User *---* Project via project_members
Project 1---* File
File 1---* FileSnapshot
- User opens a file in a project
- Frontend ensures the signed-in user has access to the file
- Frontend creates a collaborative file session
- Frontend opens a WebSocket connection for that file
- Backend hydrates the document from the persisted Yjs snapshot
- Local edits are turned into Yjs updates
- Updates are broadcast to other clients and other backend instances through Redis
- Snapshots are periodically persisted back to Postgres
- Docker Desktop
docker compose down --remove-orphans -v
docker compose up --build- App:
http://localhost:5173 - Backend docs:
http://localhost:8000/docs - Prometheus:
http://localhost:9090 - Grafana:
http://localhost:3000
Grafana default credentials:
- username:
admin - password:
admin
- Open
http://localhost:5173 - Register a user
- Create a project
- Open the starter file
- Edit code and run it from the output panel
- Sign in as user A
- Create a project and open a file
- Copy the file link
- Open the file link in a new incognito window or different browser profile
- Sign in as user B
- Both users edit the same file and watch live sync and cursor presence
- Click
Forgot password? - Submit the email
- In local development, open the returned reset link
- Set a new password
cd backend
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reloadcd frontend
npm install
npm run devcd locust
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
locust -f locustfile.py --host http://localhost:8000Backend tests live in backend/tests.
Lightweight verification used during development:
python3 -m compileall backend/app backend/tests
Planned or scaffolded verification:
- API tests
- execution tests
- Locust load tests
- containerized local integration testing
The stack includes:
- Prometheus scraping backend metrics
- Grafana dashboards provisioned from the repo
This gives the project an observability story, not just a feature demo.
backend/ FastAPI app, services, schemas, tests
frontend/ React app, Monaco integration, auth and project UI
locust/ Load-test scaffold
ops/ Prometheus config
grafana/ Provisioned dashboards
- explicit collaborator invites and permissions
- commit history and snapshots UI
- branch-based workflows
- file rename/delete UX
- repo import/export
- stronger deployment and production secret handling