TwinCode is a modern, real-time collaborative code editor that enables multiple developers to work together on the same codebase simultaneously. Built with cutting-edge web technologies, it provides instant synchronization of code changes, intelligent autocomplete suggestions, and a polished user experience.
- ** Room-Based Collaboration**: Create unique collaborative sessions with shareable URLs
- ** Real-Time Synchronization**: See code changes instantly across all connected users (WebSocket-powered)
- ** AI-Powered Autocomplete**: Intelligent code completion triggered after brief typing pauses
- ** Persistent Sessions**: Code is automatically saved and survives browser refreshes
- ** Professional UI**: Material-UI design with responsive mobile support
- ** CORS Security**: Configured for production deployment safety
- Python 3.8+
- Node.js 16+
- npm
cd pair-programming-app/backend
# Install Python dependencies
pip install -r requirements.txt
# Set environment variables (optional)
export DATABASE_URL="sqlite:///./test.db" # Or PostgreSQL URL
# Start the FastAPI server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000cd pair-programming-app/frontend
# Install Node dependencies
npm install
# Configure environment (optional - defaults to production)
echo "REACT_APP_API_ENV=development" > .env.local # For localhost backend
# Or REACT_APP_API_ENV=production for deployed backend
# Start the React development server
npm start# From project root
docker-compose up --build- Layered Architecture: Separated routers, services, models, and configuration
- WebSocket Manager: Extracted connection logic for maintainability
- Database Abstraction: SQLAlchemy ORM with async support ready
- Environment Configuration: Pydantic-based config with environment variables
- Component Structure: Modular, reusable React components with TypeScript
- API Abstraction: Centralized service layer with Axios
- Configuration Management: Environment-aware API URLs (dev/prod)
- Responsive Design: Material-UI breakpoints for cross-device support
- Code Editor: Monaco Editor integration with TypeScript support
- Conflict Resolution: Last-write-wins approach (simple, reliable for pair programming)
- Database Persistence: SQLite with room-based isolation
- WebSocket Protocol: JSON messages for type safety and easy extension
- Connection Management: Automatic cleanup and reconnection handling
- CORS Policy: Specific origin whitelisting (production-ready)
- Input Validation: Pydantic models for API data validation
- UUID Rooms: Unpredictable room IDs prevent enumeration
- Rate Limiting: Configurable per-endpoint throttling ready
🌐 Live Demo: twinco.netlify.app
The frontend is deployed on Netlify with the backend running on Koyeb. The application automatically uses production API endpoints when deployed.
- Authentication System: User login/registration with JWT tokens
- Operational Transform: Advanced conflict resolution for concurrent editing
- User Presence: Show online users, cursors, and collaborators
- File Management: Support multiple files and project structure
- Code Version History: Git-like versioning within sessions
- Language Support: Syntax highlighting and autocomplete for multiple languages
- Collaborative Cursors: Real-time cursor positions from all users
- Voice/Text Chat: Built-in communication within rooms
- Performance Monitoring: Real-time metrics and optimization
- Unit/Integration Tests: Comprehensive test coverage
- API Documentation: Swagger/OpenAPI specification
- Docker Optimization: Multi-stage builds and security scanning
- Offline Mode: Service worker for basic offline functionality
- Concurrent Editing: Simple last-write-wins may overwrite simultaneous changes
- Browser Compatibility: WebSocket support required (modern browsers only)
- Room Size: No explicit limit on users per room (performance degrades with >10)
- Language Support: Currently Python-only for autocomplete
- Authentication: No user management or room ownership
- Database Load: Frequent updates may strain SQLite in high-traffic scenarios
- Memory Usage: Large codebases consume WebSocket memory buffers
- Network Latency: Geographic distribution affects real-time responsiveness
- Scalability: Single-server architecture limits horizontal scaling
- Zero-Configuration Development: Hot-reloaded frontend/backend with environment switching
- Type Safety: Full TypeScript coverage with Pydantic validation
- Responsive Design: Mobile-first Material-UI implementation
- Production Deployment: CORS, environment configs, and deployment-ready builds
- Code Quality: ESLint compliance, cognitive complexity optimization
- Developer Experience: Clear architecture, comprehensive documentation, and modular code
- 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.
Built with ❤️ using React, FastAPI, WebSockets, and creative coding passion!