Skip to content

Write code together. Review smarter. Ship faster. live code sync, team chat, and AI-driven code reviews to streamline modern development teams.

Notifications You must be signed in to change notification settings

sameer2210/CodeX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

88 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CodeX - Collaborative AI-Powered Code Editor

CodeX Logo

Project Overview

CodeX is a real-time collaborative code editor with AI-assisted reviews, live chat, team presence, and WebRTC calling. Teams can edit code together, run JavaScript snippets, and get instant feedback in shared project rooms.

React Node Socket.IO Gemini

πŸŽ₯ Demo Video

<iframe width="800" height="450" src="https://www.youtube.com/embed/gB7qztH9BIg" title="CodeX Demo Video" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen ></iframe>

πŸ“Έ Screenshots

Landing Page Dashboard

Editor & Review Logout

πŸ—οΈ Project Architecture

CodeX/
β”œβ”€β”€ Backend/                  # Node.js + Express server
β”‚   β”œβ”€β”€ server.js
β”‚   └── src/
β”‚       β”œβ”€β”€ app.js
β”‚       β”œβ”€β”€ config/
β”‚       β”‚   └── config.js
β”‚       β”œβ”€β”€ controllers/
β”‚       β”‚   β”œβ”€β”€ auth.controllers.js
β”‚       β”‚   β”œβ”€β”€ message.controllers.js
β”‚       β”‚   └── project.controllers.js
β”‚       β”œβ”€β”€ db/
β”‚       β”‚   └── db.js
β”‚       β”œβ”€β”€ middlewares/
β”‚       β”‚   └── authMiddleware.js
β”‚       β”œβ”€β”€ models/
β”‚       β”‚   β”œβ”€β”€ message.model.js
β”‚       β”‚   β”œβ”€β”€ project.model.js
β”‚       β”‚   └── team.model.js
β”‚       β”œβ”€β”€ routes/
β”‚       β”‚   β”œβ”€β”€ auth.routes.js
β”‚       β”‚   β”œβ”€β”€ message.routes.js
β”‚       β”‚   β”œβ”€β”€ project.routes.js
β”‚       β”‚   └── webrtc.routes.js
β”‚       β”œβ”€β”€ services/
β”‚       β”‚   β”œβ”€β”€ ai.service.js
β”‚       β”‚   β”œβ”€β”€ auth.service.js
β”‚       β”‚   β”œβ”€β”€ call.service.js
β”‚       β”‚   β”œβ”€β”€ message.service.js
β”‚       β”‚   └── project.service.js
β”‚       └── tests/
β”‚           β”œβ”€β”€ auth.test.js
β”‚           └── project.test.js
β”œβ”€β”€ Frontend/                 # React + Vite application
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ vite.config.js
β”‚   └── src/
β”‚       β”œβ”€β”€ App.jsx
β”‚       β”œβ”€β”€ main.jsx
β”‚       β”œβ”€β”€ index.css
β”‚       β”œβ”€β”€ api/
β”‚       β”‚   β”œβ”€β”€ config.jsx
β”‚       β”‚   └── project.api.js
β”‚       β”œβ”€β”€ components/
β”‚       β”‚   β”œβ”€β”€ CallingPage.jsx
β”‚       β”‚   β”œβ”€β”€ ErrorBoundary.jsx
β”‚       β”‚   β”œβ”€β”€ HUD.jsx
β”‚       β”‚   β”œβ”€β”€ layout/
β”‚       β”‚   β”‚   β”œβ”€β”€ Layout.jsx
β”‚       β”‚   β”‚   β”œβ”€β”€ Navigation.jsx
β”‚       β”‚   β”‚   └── Sidebar.jsx
β”‚       β”‚   β”œβ”€β”€ page/
β”‚       β”‚   β”‚   β”œβ”€β”€ ActiveMember.jsx
β”‚       β”‚   β”‚   β”œβ”€β”€ ActiveMemberPage.jsx
β”‚       β”‚   β”‚   β”œβ”€β”€ Help.jsx
β”‚       β”‚   β”‚   β”œβ”€β”€ Meeting.jsx
β”‚       β”‚   β”‚   β”œβ”€β”€ Notification.jsx
β”‚       β”‚   β”‚   └── Settings.jsx
β”‚       β”‚   └── ui/
β”‚       β”‚       β”œβ”€β”€ Button.jsx
β”‚       β”‚       └── ResizableContainer.jsx
β”‚       β”œβ”€β”€ context/
β”‚       β”‚   └── ThemeContext.jsx
β”‚       β”œβ”€β”€ lib/
β”‚       β”‚   β”œβ”€β”€ notify.js
β”‚       β”‚   └── sounds.js
β”‚       β”œβ”€β”€ routes/
β”‚       β”‚   └── Routes.jsx
β”‚       β”œβ”€β”€ services/
β”‚       β”‚   └── dashboardService.jsx
β”‚       β”œβ”€β”€ store/
β”‚       β”‚   β”œβ”€β”€ hooks.js
β”‚       β”‚   β”œβ”€β”€ socketMiddleware.js
β”‚       β”‚   β”œβ”€β”€ store.js
β”‚       β”‚   └── slices/
β”‚       β”‚       β”œβ”€β”€ authSlice.js
β”‚       β”‚       β”œβ”€β”€ callSlice.js
β”‚       β”‚       β”œβ”€β”€ projectSlice.js
β”‚       β”‚       └── socketSlice.js
β”‚       β”œβ”€β”€ tests/
β”‚       β”‚   β”œβ”€β”€ Login.test.jsx
β”‚       β”‚   └── setup.js
β”‚       β”œβ”€β”€ views/
β”‚       β”‚   β”œβ”€β”€ Dashboard.jsx
β”‚       β”‚   β”œβ”€β”€ Landing.jsx
β”‚       β”‚   β”œβ”€β”€ NotFound.jsx
β”‚       β”‚   β”œβ”€β”€ auth/
β”‚       β”‚   β”‚   β”œβ”€β”€ Login.jsx
β”‚       β”‚   β”‚   └── Register.jsx
β”‚       β”‚   β”œβ”€β”€ create-project/
β”‚       β”‚   β”‚   └── CreateProject.jsx
β”‚       β”‚   └── home/
β”‚       β”‚       └── project/
β”‚       β”‚           β”œβ”€β”€ Project.jsx
β”‚       β”‚           └── components/
β”‚       β”‚               β”œβ”€β”€ ChatSection.jsx
β”‚       β”‚               β”œβ”€β”€ CodeEditor.jsx
β”‚       β”‚               β”œβ”€β”€ OutputPanel.jsx
β”‚       β”‚               └── ReviewPanel.jsx
β”‚       └── webrtc/
β”‚           β”œβ”€β”€ callManager.js
β”‚           β”œβ”€β”€ media.js
β”‚           └── peer.js
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ code.png
β”‚   β”œβ”€β”€ codeXDemo.mp4
β”‚   β”œβ”€β”€ dashboard.png
β”‚   β”œβ”€β”€ demo.png
β”‚   β”œβ”€β”€ logo.png
β”‚   β”œβ”€β”€ logout.png
β”‚   └── og-image.png
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ playwright.config.js
β”‚   β”œβ”€β”€ e2e/
β”‚   β”‚   └── flow.spec.js
β”‚   └── load/
β”‚       └── simulation.js
β”œβ”€β”€ package.json
└── Readme.md

Technology Stack

Backend Technologies

  • Node.js
  • Express.js
  • MongoDB + Mongoose
  • Socket.io
  • Google Generative AI (Gemini)
  • JWT authentication
  • WebRTC signaling + STUN/TURN discovery
  • Helmet, CORS, Morgan

Frontend Technologies

  • React 19 + Vite
  • Tailwind CSS
  • Redux Toolkit + Redux Persist
  • React Router DOM
  • Monaco Editor
  • Socket.io Client
  • Framer Motion
  • React Hook Form + Yup
  • Recharts
  • WebRTC (peer connections, media devices)

Testing

  • Jest + Supertest (Backend)
  • Vitest + Testing Library (Frontend)
  • Playwright (E2E)

πŸ’‘ Key Features

1. Real-time Collaboration

  • Live code sync across project rooms
  • Instant updates using Socket.io
  • Team presence with active user lists

2. AI-Powered Code Review

  • Google Gemini AI analysis
  • Best-practice suggestions and feedback
  • Review panel with markdown output

3. Built-in Code Execution

  • Run JavaScript snippets in a sandboxed VM
  • Output panel for stdout and errors

4. WebRTC Audio/Video Calls

  • Team-to-team or 1:1 calls
  • ICE server discovery via /api/webrtc/turn
  • Live call status and notifications

5. Team Communication

  • Live chat with history
  • Typing indicators
  • Notifications and activity tracking

πŸ”„ How It Works

1. Project Creation & Access

User β†’ /api/auth/login β†’ JWT β†’ /api/projects/create β†’ Project Created

2. Real-time Collaboration

Editor changes β†’ Socket.io (code-change) β†’ Synced to project room
Chat message β†’ Socket.io (chat-message) β†’ Stored in MongoDB

3. AI Code Review

Get Review β†’ /api/projects/:id/review or socket event β†’ Gemini β†’ Review Panel

4. Code Execution

Run Code β†’ /api/projects/:id/execute β†’ Node VM β†’ Output Panel

5. WebRTC Calls

Start Call β†’ Socket.io signaling β†’ /api/webrtc/turn β†’ Peer connection

πŸ›£οΈ API Routes & Endpoints

Auth (/api/auth)

  • POST /register - Team registration
  • POST /login - Login
  • GET /verify - Verify token
  • POST /logout - Logout
  • GET /team/:teamName/members - Team members
  • PUT /team/:teamName/member/:username/activity - Update member activity
  • GET /team/:teamName/messages - Team messages

Projects (/api/projects)

  • POST /create - Create project
  • GET /get-all - List projects
  • GET /:id - Get project
  • PUT /:id - Update project (code)
  • POST /:id/execute - Execute JavaScript code
  • POST /:id/review - AI review

Messages (/api/messages)

  • GET /project/:projectId - Project chat history
  • GET /project/:projectId/unread - Unread count

WebRTC (/api/webrtc)

  • GET /turn - ICE server configuration

Socket.io Events (Selected)

  • join-project, leave-project
  • chat-history, chat-message
  • typing-start, typing-stop
  • code-change
  • get-review, code-review
  • user-online, user-offline, team-presence, active-users
  • call:initiate, call:accept, call:reject, call:end, call:ice-candidate

πŸ“± Frontend Routes

  • / - Landing
  • /login - Login
  • /register - Register
  • /dashboard - Dashboard
  • /projects - Project list
  • /create-project - Create project
  • /project/:id - Project workspace
  • /meeting - Meeting lobby
  • /meeting/:projectId - Project meeting
  • /active-members - Active members
  • /settings - Settings
  • /help - Help
  • /notifications - Notifications
  • /not-found - 404 page

πŸ”Œ Database Models

Project Model

{
  name: String (required),
  teamName: String (required),
  code: String (default: ""),
  review: String (default: ""),
  timestamps: true
}

Message Model

{
  projectId: ObjectId (Project),
  teamName: String,
  username: String,
  message: String,
  type: "user" | "system" | "notification",
  metadata: { edited, editedAt, replyTo },
  timestamps: true
}

Team Model

{
  teamName: String (unique),
  password: String (hashed),
  members: [{ username, isAdmin, lastLogin, joinedAt, isActive }],
  createdAt: Date,
  updatedAt: Date
}

πŸš€ Getting Started

Prerequisites

  • Node.js (v18 or higher)
  • MongoDB database
  • Google Gemini API key

Backend Setup

cd Backend
npm install
npm start

Frontend Setup

cd Frontend
npm install
npm run dev

Environment Variables

Create a .env file in Backend/:

PORT=8000
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
GOOGLE_API_KEY=your_gemini_api_key
FRONTEND_URLS=http://localhost:5173,https://your-frontend-domain.com
STUN_URLS=stun:stun.l.google.com:19302
TURN_URLS=turn:your-turn-host:3478?transport=udp,turn:your-turn-host:3478?transport=tcp
TURN_USERNAME=your_turn_username
TURN_CREDENTIAL=your_turn_credential

Create a .env file in Frontend/:

VITE_BACKEND_URL=http://localhost:8000

πŸ”§ Development Workflow

1. Project Creation

  1. User navigates to /create-project
  2. Enters project name
  3. Backend creates MongoDB document
  4. User is redirected to project workspace

2. Collaborative Coding

  1. Multiple users join the same project
  2. Each user connects via Socket.io
  3. Code changes are broadcasted to all users
  4. Chat messages are synchronized in real-time

3. AI Code Review

  1. Developer clicks "Get Review"
  2. Current code is sent to Gemini AI service
  3. AI analyzes code and provides feedback
  4. Review is displayed in markdown

πŸ§ͺ Testing

  • Backend: cd Backend && npm test
  • Frontend: cd Frontend && npm run test
  • E2E: npx playwright test (from repo root)

πŸš€ Deployment

Backend Deployment

  • Deploy to Render, Railway, Heroku, or AWS
  • Set production environment variables
  • Ensure MongoDB connection is accessible

Frontend Deployment

  • Build with npm run build
  • Deploy to Vercel, Netlify, or any static hosting
  • Point VITE_BACKEND_URL to production API

πŸ”’ Security Considerations

  • JWT-based authentication
  • CORS allow-list configuration
  • Input validation in controllers
  • Secure API key storage in environment variables

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

πŸ‘¨β€πŸ’» Developer

Sameer Khan

Full Stack Developer (MERN)

Portfolio LinkedIn GitHub Email

πŸ’Ό Technical Skills

Frontend: React.js, Next.js, Redux, Tailwind CSS, Bootstrap, Framer Motion, Recharts

Backend: Node.js, Express.js, MongoDB, MySQL, JWT, Socket.io, Redis

DevOps: Docker, Git, Postman, Vercel, Render, Cloudinary

πŸ† Certifications

  • MERN Full Stack Development
  • Core Java
  • Data Structures & Algorithms

**Happy Coding with CodeX! **

About

Write code together. Review smarter. Ship faster. live code sync, team chat, and AI-driven code reviews to streamline modern development teams.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages