A simple real-time collaborative text editor built with React (frontend) and FastAPI (backend) using WebSockets for live synchronization between multiple clients.
This project demonstrates how real-time communication can be implemented in a full-stack application using a WebSocket-based architecture.
- Real-time text synchronization between connected users
- WebSocket-based communication
- FastAPI backend for managing connections and events
- React frontend with a basic text editor interface
- Lightweight database setup using SQLAlchemy
- Simple full-stack architecture separating frontend and backend
Frontend
- React
- JavaScript
- WebSocket client
Backend
- Python
- FastAPI
- WebSockets
- SQLAlchemy
- Redis (basic structure present)
collaborative-editor
│
├── backend
│ ├── app
│ │ ├── main.py
│ │ ├── database.py
│ │ ├── models.py
│ │ ├── redis_client.py
│ │ ├── redis_listener.py
│ │ └── websocket_manager.py
│ │
│ └── requirements.txt
│
├── frontend
│ ├── public
│ ├── src
│ │ └── App.js
│ ├── package.json
│ └── package-lock.json
│
└── README.md
- The React frontend opens a WebSocket connection with the FastAPI backend.
- When a user edits the text, the update is sent through the WebSocket.
- The backend broadcasts the update to all connected clients.
- Each client updates its editor in real time.
git clone https://github.com/Harshit-Tiwary/collaborative-editor.git
cd collaborative-editor
cd backend
pip install -r requirements.txt
uvicorn app.main:app --reload
Backend runs on:
http://127.0.0.1:8000
cd frontend
npm install
npm start
Frontend runs on:
http://localhost:3000
This project was built to practice:
- Full-stack application architecture
- WebSocket based real-time communication
- FastAPI backend development
- React frontend integration
- Managing live client connections
Possible improvements include:
- Conflict resolution for simultaneous edits
- Persistent document storage
- Authentication for users
- Redis pub/sub for scaling real-time updates
- Docker-based deployment