A real-time collaborative code sharing platform that allows developers to share their coding sessions live with spectators. Built with FastAPI (backend) and React (frontend).
- π Real-time Code Collaboration: Share your code with multiple spectators in real-time
- π¨ Syntax Highlighting: Powered by Monaco Editor with support for multiple languages
- π₯ Role-based Access: Presenter (read/write) vs Spectator (read-only)
- π Live Synchronization: WebSocket-based real-time updates
- π Multi-language Support: Python, JavaScript, TypeScript, and more
Frontend: https://livecode-session.up.railway.app/
Backend API: https://livecode-session-production.up.railway.app
API Docs: https://livecode-session-production.up.railway.app/docs
- FastAPI - Modern Python web framework
- WebSocket - Real-time bidirectional communication
- Uvicorn - Lightning-fast ASGI server
- Pydantic - Data validation
- React 18 with TypeScript
- Vite - Next generation frontend tooling
- TanStack Router - Type-safe routing
- TanStack Query - Powerful data synchronization
- Zustand - Lightweight state management
- Monaco Editor - VS Code's editor in the browser
This application is deployed on Railway with automatic deployments from GitHub.
- Platform: Railway with Railpack
- URL: https://livecode-session-production.up.railway.app
- WebSocket: wss://livecode-session-production.up.railway.app
- Root Directory:
backend
- Platform: Railway with Railpack
- URL: https://livecode-session.up.railway.app
- Build: Vite production build
- Server: Vite preview server
- Root Directory:
frontend
Frontend (set in Railway Variables):
VITE_API_URL=https://livecode-session-production.up.railway.app
VITE_WS_URL=wss://livecode-session-production.up.railway.app
- Python 3.9+
- Node.js 18+
- npm or yarn
cd backend
pip install -r requirements.txt
uvicorn main:app --reload --host 0.0.0.0 --port 8000The API will be available at http://localhost:8000
- API docs (Swagger):
http://localhost:8000/docs - Health check:
http://localhost:8000/health
cd frontend
npm install
npm run devThe frontend will be available at http://localhost:5173
Create .env in the frontend directory:
VITE_API_URL=http://localhost:8000
VITE_WS_URL=ws://localhost:8000
livecode-session/
βββ backend/ # FastAPI backend
β βββ main.py # Main application entry
β βββ requirements.txt # Python dependencies
β βββ railway.toml # Railway backend config
βββ frontend/ # React frontend
β βββ src/
β β βββ components/ # React components
β β βββ hooks/ # Custom React hooks
β β βββ pages/ # Page components
β β βββ routes/ # Router configuration
β β βββ store/ # Zustand state management
β βββ railway.toml # Railway frontend config
β βββ vite.config.ts # Vite configuration
β βββ .env.production # Production environment variables
βββ README.md
POST /sessions- Create a new sessionGET /sessions/{session_id}- Get session detailsPUT /sessions/{session_id}- Update session codeGET /health- Health check endpoint
WS /ws/{session_id}/{role}- Connect to session- Events:
init,code_update,cursor_move - Roles:
presenterorspectator
- Events:
- Each coding session has a unique ID
- Sessions are stored in-memory (can be extended to use a database)
- Clients join rooms based on session ID
- Real-time synchronization using WebSocket events
- Presenter: Full read/write access to the code
- Spectator: Read-only access with real-time updates
- Code changes are broadcast via WebSocket
- All connected clients receive updates instantly
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is open source and available under the MIT License.
- Monaco Editor by Microsoft
- FastAPI by SebastiΓ‘n RamΓrez
- Railway for hosting
Enjoy coding together! π