CodeWhiz is a real-time collaborative code editor web application that allows multiple users to work on the same code file together. Whether you're working on a team project or simply pair programming, this app lets you create coding rooms, invite others, and collaborate seamlessly in your browser!
-
Real-Time Collaborative Editing
- π See live code updates from other users instantly.
- π€ View the usernames of everyone connected to the session.
- βοΈ See other users' cursors and actions as they edit in real time.
-
Create Public/Private Rooms
- π Generate unique, shareable room URLs.
- π Option to create private rooms for secure collaboration.
-
No Refresh Required
- π«π Experience real-time collaboration without needing to refresh your browser.
-
Frontend
- βοΈ React.js - For building a responsive, interactive user interface.
- π¨ CodeMirror (v5.65.2) - As the code editor UI component.
-
Backend
- βοΈ Node.js - For the server runtime.
- π Express.js - As the server framework for managing requests.
- π§βπ» Socket.IO - Enables real-time, bidirectional communication between users.
-
Deployment
- β‘ Vercel - For easy and fast deployment.
-
Other Tools
- π uuid - For generating unique room IDs.
- π react-hot-toast - For providing sleek pop-up notifications (toasts).
Here's the app's home page where you can create and join rooms:
Easily generate a unique Room ID:
This is the main editor window, with a dashboard showing all connected users and the shared code editor:
Share the Room ID to invite others and start collaborating!
Watch code changes happen live as other users contribute!
Notification toaster shows up when new user is joined
Notification toaster shows up when user leaves the room
Want to try it out locally? Follow these simple steps to get up and running!
The project is organized as follows:
codewhiz/
βββ public/
β βββ index.html # Main HTML file
β βββ favicon.ico # Favicon for the app
β βββ manifest.json # Web app manifest
β βββ robots.txt # Robots exclusion file
βββ src/
β βββ components/
β β βββ Header.js # Header component
β β βββ Footer.js # Footer component
β β βββ ... # Other reusable components
β βββ pages/
β β βββ HomePage.js # Home page component
β β βββ AboutPage.js # About page component
β β βββ ... # Other page-level components
β βββ assets/
β β βββ images/ # Image assets
β β βββ styles/ # Global and component-specific styles
β β βββ ... # Other static assets
β βββ App.js # Main application component
β βββ App.css # Styles for the App component
β βββ index.js # Entry point for React
β βββ index.css # Global styles
β βββ reportWebVitals.js # Performance reporting
βββ .gitignore # Git ignore file
βββ package.json # Project metadata and dependencies
βββ package-lock.json # Lockfile for npm dependencies
βββ README.md # Project documentation
βββ node_modules/ # Installed npm packages (auto-generated)
-
Clone the project
git clone https://github.com/Aashay30/CodeWhiz
-
Navigate to the project directory
cd codewhiz
-
Install dependencies
npm install
-
Start the app
npm run both
During the development of CodeWhiz, several technical and design challenges were encountered. Hereβs how I approached and solved them, using a STAR (Situation, Task, Action, Result) format for behavioral interview answers:
- Situation:
Multiple users needed to see code changes reflected instantly in a shared editor, regardless of network speed or temporary disconnections. - Task:
Ensure all users in a room have a consistent, up-to-date view of the code in real time. - Action:
- Integrated Socket.IO for real-time, bidirectional communication.
- Broadcasted code changes as events to all connected users in a room.
- Implemented reconnection logic to resync the editor state for users who temporarily lost connection.
- Batched and debounced updates to optimize network usage.
- Result:
Achieved seamless, real-time code collaboration with minimal latency and robust handling of network interruptions.
- Situation:
Simultaneous editing by multiple users could lead to conflicts and confusion. - Task:
Track user actions, display active users, and prevent conflicting edits. - Action:
- Assigned unique identifiers (UUIDs) to each user session.
- Implemented a system to track and display each userβs cursor position in the editor.
- Added a locking mechanism for critical code sections to avoid race conditions.
- Displayed a real-time list of connected users in each room.
- Result:
Enhanced collaboration transparency and minimized editing conflicts, improving the overall user experience.
- Situation:
Frequent updates from multiple users could degrade performance and responsiveness. - Task:
Keep the app fast and responsive, even with many users or rapid code changes. - Action:
- Transmitted only code deltas (changes) instead of the full document.
- Used debouncing to limit update frequency during rapid typing.
- Leveraged Reactβs
useMemo
anduseCallback
to prevent unnecessary re-renders. - Stress-tested the app under simulated high-load conditions.
- Result:
Maintained a smooth, lag-free editing experience for all users, even under heavy usage.
- Situation:
Users needed to create and join rooms securely, with options for public and private collaboration. - Task:
Implement secure room creation, joining, and access control. - Action:
- Generated unique room IDs using the UUID library.
- Added server-side validation for room IDs and access permissions.
- Enabled private rooms with password or invite-link protection.
- Ensured sensitive data was never exposed in client-side code.
- Result:
Provided a secure and flexible collaboration environment, supporting both public and private coding sessions.
- Situation:
Users accessed CodeWhiz from various browsers and devices, requiring consistent functionality everywhere. - Task:
Guarantee seamless operation across all major browsers. - Action:
- Defined supported browsers using
browserslist
in the project config. - Tested and fixed issues on Chrome, Firefox, Safari, and Edge.
- Used polyfills for unsupported features in older browsers.
- Defined supported browsers using
- Result:
Delivered a reliable, consistent experience for all users, regardless of their browser or device.
- Situation:
Real-time collaboration can be confusing without clear feedback and notifications. - Task:
Provide intuitive UI cues and notifications for key events. - Action:
- Integrated
react-hot-toast
for real-time notifications (e.g., user join/leave). - Designed a clean, responsive UI with React and CSS for usability on all devices.
- Added helpful error messages and fallback UI for common issues.
- Integrated
- Result:
Improved user engagement and clarity, making collaboration easy and enjoyable for all skill levels.
These challenges demonstrate my ability to build robust, real-time collaborative applications, optimize performance, ensure security, and deliver a polished user experienceβskills that are highly valuable for any software engineering role.
- Gained hands-on experience building a real-time collaborative code editor using Socket.IO for instant, bidirectional communication.
- Learned how to synchronize state across multiple users and handle reconnections gracefully.
- Built a responsive, interactive UI with React.js and CodeMirror for a seamless editing experience.
- Utilized React hooks like
useMemo
anduseCallback
to optimize rendering and performance.
- Designed and implemented a scalable backend to manage rooms, users, and real-time events.
- Ensured efficient handling of WebSocket connections and secure room management.
- Optimized real-time updates by sending only code deltas and debouncing rapid changes.
- Stress-tested the application to ensure smooth performance under high user load.
- Implemented secure room creation and joining, including private room support with password/invite protection.
- Ensured sensitive data was handled securely and never exposed on the client side.
- Ensured consistent functionality and appearance across all major browsers using polyfills and thorough testing.
- Integrated real-time notifications and clear UI cues for collaborative actions using
react-hot-toast
. - Designed a clean, intuitive interface for both technical and non-technical users.
- Structured the project for maintainability and scalability, separating frontend and backend concerns.
- Documented the codebase and project structure for easy onboarding and future enhancements.
- Tackled complex issues like race conditions, synchronization bugs, and performance bottlenecks.
- Developed effective debugging strategies for real-time, multi-user environments.
- Improved documentation and communication skills by making the project accessible for other developers.
- Designed features with extensibility and teamwork in mind.
The CodeWhiz project provided deep experience in building robust, real-time collaborative applications. It highlights strengths in full-stack development, performance optimization, security, and user-centric designβskills that are highly valuable for modern software engineering roles.