A real-time collaborative whiteboard web application built with Python Flask and Socket.IO. Perfect for online meetings, brainstorming sessions, teaching, and creative collaboration.
- Real-time Collaboration: Multiple users can draw simultaneously with live synchronization
- Multiple Rooms: Create and join different rooms for separate sessions
- Drawing Tools: Pen and eraser with customizable colors and brush sizes
- User Awareness: See other users' cursors in real-time with their names
- Persistent Sessions: Room state is maintained as users join and leave
- Mobile Support: Touch-friendly interface that works on tablets and phones
- Export Functionality: Save your whiteboard as PNG images
- Clean UI: Modern, responsive design with intuitive controls
- Python 3.8 or higher
- pip (Python package manager)
-
Clone the repository
git clone https://github.com/yourusername/collaborative-whiteboard.git cd collaborative-whiteboard -
Create a virtual environment
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Run the application
python main.py
-
Open your browser Navigate to
http://localhost:5000
- Enter your name in the username field (optional)
- Join a room by entering a room ID or use the default room
- Start drawing using the pen tool
- Switch tools between pen and eraser
- Customize your brush color and size
- Collaborate with others in real-time!
- Default Room: All users start in the "default" room
- Custom Rooms: Create private sessions by entering a unique room ID
- Direct Links: Share URLs like
http://localhost:5000/room/my-room-namefor easy access - Persistent State: Drawings remain in the room even when users leave
- Pen Tool: Draw with customizable colors and sizes (1-50px)
- Eraser Tool: Remove parts of your drawing
- Color Picker: Choose any color or use preset colors
- Clear Canvas: Remove all drawings (requires confirmation)
- Save Image: Download the current canvas as a PNG file
- Flask: Web framework for serving the application
- Flask-SocketIO: Real-time bidirectional communication
- Room Management: Isolated drawing sessions
- Event Handling: Draw, erase, user management events
- Canvas API: High-performance drawing with HTML5 Canvas
- Socket.IO Client: Real-time communication with the server
- Responsive Design: Works on desktop, tablet, and mobile
- ES6 Classes: Clean, modular JavaScript architecture
main.py # Flask application and Socket.IO handlers
templates/index.html # Main HTML template
static/css/style.css # Responsive styles and animations
static/js/whiteboard.js # Client-side drawing and collaboration logic
You can customize the application using environment variables:
export FLASK_SECRET_KEY="your-secret-key"
export FLASK_HOST="0.0.0.0"
export FLASK_PORT="5000"
export FLASK_DEBUG="False"For production deployment, consider:
-
Use a production WSGI server (gunicorn is included):
gunicorn --worker-class eventlet -w 1 main:app
-
Set a secure secret key in production
-
Use a reverse proxy (nginx) for better performance
-
Enable HTTPS for secure connections
We welcome contributions! Here's how you can help:
- 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
- Follow the installation steps above
- Enable debug mode by setting
debug=Trueinmain.py - The application will auto-reload on code changes
- Follow PEP 8 for Python code
- Use meaningful variable and function names
- Add comments for complex logic
- Keep functions small and focused
join_room: Join a specific roomdraw: Send drawing dataerase: Send eraser dataclear_canvas: Clear the entire canvascursor_move: Update cursor positionchange_tool: Notify tool changes
user_connected: User connection confirmationdrawing_data: Initial room drawing datadraw: Receive drawing data from otherserase: Receive eraser data from othersclear_canvas: Canvas cleared by another useruser_joined: User joined notificationuser_left: User left notificationusers_update: Updated users listcursor_move: Other users' cursor positions
- Canvas not responding: Check if JavaScript is enabled
- Connection issues: Verify the server is running on the correct port
- Mobile drawing problems: Ensure touch events are supported
- Performance issues: Reduce brush size or refresh the page
Enable debug mode in main.py:
socketio.run(app, debug=True, host='0.0.0.0', port=5000)This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Flask and Socket.IO
- Canvas drawing techniques inspired by modern web standards
- UI design follows modern web design principles
- Shape tools (rectangles, circles, lines)
- Text tool with customizable fonts
- Layers support
- Undo/Redo functionality
- User authentication and room permissions
- Drawing history and version control
- Integration with cloud storage
- Voice/video chat integration
- Mobile app versions
Made with โค๏ธ for collaborative creativity