Real-Time Collaborative IDE with Gemini AI Review
PairCode is a full-stack web application where developers can collaborate in a shared code editor in real time, get instant AI-powered code review via Google Gemini and execute code in a secure sandbox β all in the browser.
- Multiple developers join a shared room using a unique Room ID
- Code changes, language switches, and cursor positions sync instantly across all participants
- Shared notepad panel for taking notes together during a session
- Live user presence list with join/leave notifications
- Click "AI Review" to instantly analyze your code with Google Gemini 2.5 Flash
- Detects bugs, complexity issues, and style violations
- Returns structured feedback:
bugs,suggestions,quality rating (1β10), and asummary - Review results auto-saved to your history (when logged in)
- Persistent multi-turn chatbot sidebar in the editor
- Automatically aware of the current code in the editor buffer
- Surfaces AI Review results directly in the chat conversation
- Run code right in the browser via Judge0 sandboxed execution
- Supports Python, JavaScript, and Java
- Execution output is broadcast to all room members simultaneously
- Email/password registration & login
- Google OAuth 2.0 sign-in
- JWT-based stateless authentication (7-day expiry)
- View all past AI review sessions with ratings and timestamps
- Replay any past review's full feedback
- Delete individual history entries
| Technology | Purpose |
|---|---|
| React 19 | UI framework |
| Vite | Build tool & dev server |
| React Router DOM v7 | Client-side routing |
| Socket.IO Client | Real-time communication |
| CodeMirror 5 | Embedded code editor |
| React Hot Toast | Notifications |
| Vanilla CSS | Styling |
| Technology | Purpose |
|---|---|
| Node.js + Express 5 | REST API server |
| Socket.IO | WebSocket server |
| MongoDB + Mongoose | Database & ODM |
| Passport.js | Authentication strategies |
| JWT | Stateless auth tokens |
| bcryptjs | Password hashing |
| Google Gemini API | AI code review & chat |
| Judge0 API | Sandboxed code execution |
PairCode/
βββ server.js # Express + Socket.IO server (all real-time logic)
βββ Actions.js # Socket event name constants
βββ vite.config.js # Vite configuration
β
βββ routes/
β βββ auth.js # Register, login, Google OAuth
β βββ review.js # Gemini AI code review
β βββ chat.js # Gemini AI multi-turn chat
β βββ history.js # User session history CRUD
β
βββ models/
β βββ User.js # User schema
β βββ Session.js # AI review history schema
β
βββ middleware/
β βββ authMiddleware.js # JWT verification middleware
β
βββ src/ # React frontend (Vite)
βββ main.jsx # Entry point
βββ App.jsx # Router & global layout
βββ socket.js # Socket.IO client singleton
β
βββ context/
β βββ AuthContext.jsx # Global auth state (user, token, login, logout)
β
βββ pages/
β βββ LandingPage.jsx # Marketing homepage
β βββ HomePage.jsx # Join/create room
β βββ EditorPage.jsx # Collaborative code editor
β βββ Dashboard.jsx # User profile & review history
β βββ Login.jsx
β βββ Register.jsx
β
βββ Components/
βββ Editor.jsx # CodeMirror wrapper
βββ AIChatPanel.jsx # Gemini AI chat sidebar
βββ NotepadPanel.jsx # Shared notepad
βββ ReviewPanel.jsx # Displays AI review result
βββ Client.jsx # User avatar component
βββ ProtectedRoute.jsx # Auth guard
- Node.js v18+
- MongoDB (local or Atlas URI)
- Google Gemini API Key
- Google OAuth Credentials
git clone https://github.com/Jaykolate/PairCode.git
cd PairCodenpm installCreate a .env file in the project root:
# MongoDB
MONGO_URI=mongodb://localhost:27017/paircode
# JWT
JWT_SECRET=your_super_secret_jwt_key
# Google Gemini AI
GEMINI_API_KEY=your_gemini_api_key
# Google OAuth
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
# URLs
VITE_BACKEND_URL=http://localhost:10000
VITE_FRONTEND_URL=http://localhost:5173
# Server Port
PORT=10000Development mode (run both simultaneously):
# Terminal 1 β Start the backend server
npm run server:dev
# Terminal 2 β Start the Vite frontend
npm run devProduction mode:
npm run build
npm run server:prodThe frontend is served as static files from the Express server at http://localhost:10000.
| Method | Endpoint | Auth Required | Description |
|---|---|---|---|
POST |
/api/auth/register |
No | Create a new account |
POST |
/api/auth/login |
No | Login, receive JWT |
GET |
/api/auth/google |
No | Start Google OAuth flow |
POST |
/api/review |
Optional | Run Gemini AI code review |
POST |
/api/chat |
No | Send a message to Gemini AI chat |
GET |
/api/history |
Yes | Get user's review history |
DELETE |
/api/history/:id |
Yes | Delete a review session |
User types code
β emits CODE_CHANGE (via Socket.IO)
β Server broadcasts to all others in the room
β Their editors update instantly
| Path | Page | Auth |
|---|---|---|
/ |
Landing Page | No |
/join |
Create / Join Room | No |
/editor/:roomId |
Collaborative Editor | No |
/login |
Login | No |
/register |
Register | No |
/dashboard |
User Dashboard | β Yes |
| Command | Description |
|---|---|
npm run dev |
Start Vite frontend dev server |
npm run server:dev |
Start backend with nodemon (auto-reload) |
npm run server:prod |
Start backend in production mode |
npm run build |
Build frontend for production |
npm run lint |
Run ESLint |
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Commit your changes:
git commit -m 'Add some feature' - Push to the branch:
git push origin feature/your-feature - Open a Pull Request
This project is open source. See the LICENSE file for details.
Built with β€οΈ using React, Node.js, Socket.IO, and Google Gemini AI