# bhavish2005/fixmate-cc-ide architecture

> Architecture diagram of the GitHub repository bhavish2005/fixmate-cc-ide, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bhavish2005/fixmate-cc-ide
- Repository: https://github.com/bhavish2005/fixmate-cc-ide

## Overview

##### Project type and purpose
- This is a full-stack, real-time collaborative code editor (“FixMate”) aimed at pair programming, technical interviews, and remote learning.
- Frontend built with React/Vite for UI, Monaco for code editing, Stream.io for video/chat, and Socket.io for real-time sync.
- Backend built with Node.js/Express, MongoDB/Mongoose for data, Socket.io for live collaboration, Firebase Admin for OAuth, JWT for auth, and integrations with external AI (Google Gemini), code execution (Piston API), and email (Nodemailer).

##### File structure
- Top-level separation:
- CollabrativeCodeEditor/ → React/Vite client
- codeeditor-backend/ → Node/Express server
- Frontend folders:
- src/components – UI pieces (Navbar, ChatPanel, CodeEditor, VideoPanel, AI Sidebar)
- src/pages – route views (Dashboard, RoomPage, Login/Register)
- src/context/AuthContext, src/firebase.js – auth setup
- src/socket.js – Socket.io client initialization
- vite.config.js, public/index.html, package.json – build/config
- Backend folders:
- src/config – DB connection (db.js), Firebase Admin init
- src/controllers – request handlers (auth.controller.js)
- src/routes – endpoints (/auth, /stream)
- src/models – Mongoose schemas (User, Error)
- socket.js & index.js – Socket.io server, Express startup
- src/utils – JWT setup, Zod validation, sendEmail
- Configuration: .env variables for Mongo URI, JWT secrets, Stream keys, Gemini key, Firebase credentials, FRONTEND_URL.

##### README for additional insights
- Features: real-time editing, video/chat, AI assistant, code execution, secure auth, dashboards, Vim mode.
- Services: MongoDB Atlas, Firebase Auth, Stream.io, Piston API, Google Gemini.
- Tech stack table confirming React/Vite/TailwindCSS/FramerMotion on front, Node/Express/Mongo/Socket.io on back.

##### Final advice
- Keep it readable: group related elements (auth, streaming, data) visually.
- Iterate: start simple, then expand to show deeper integrations (e.g., Zod schema validation in auth flow).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend (Port 5173)"
      direction TB
      ClientApp["Client Application\n(React/Vite)"]:::frontend
      CodeEditor["Code Editor UI\n(Monaco)"]:::frontend
      SocketClient["Real-time Collaboration\n(Socket.io Client)"]:::frontend
      VideoChatUI["Video & Chat UI\n(Stream.io React SDK)"]:::frontend
      AuthContext["Authentication Context\n(Firebase Auth)"]:::frontend
      FirebaseFrontInit["Firebase Init"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend (Port 4000)"
      direction TB
      ExpressServer["REST/API Layer\n(Express)"]:::backend
      SocketServer["Real-time Collaboration\n(Socket.io Server)"]:::backend
      DBConfig["DB Connection\n(MongoDB/Mongoose)"]:::database
      FirebaseAdmin["Firebase Admin Init\n(OAuth Verify)"]:::backend
      AuthController["Auth Controllers"]:::backend
      AuthRoutes["Auth Routes\n(login/register)"]:::backend
      StreamRoutes["Stream Routes\n(video/chat mgmt)"]:::backend
      UserModel["User Model"]:::database
      ErrorModel["Error Model"]:::database
      JWTUtil["JWT Setup Utility"]:::backend
      ZodSchema["Zod Validation Schemas"]:::backend
      EmailService["Email Service\n(Nodemailer)"]:::backend
    end

    %% External Services
    subgraph "External Services"
      direction TB
      MongoAtlas["MongoDB Atlas"]:::external
      FirebaseAuthSvc["Firebase Auth"]:::external
      StreamSvc["Stream.io"]:::external
      Gemini["Google Gemini API"]:::external
      Piston["Piston API"]:::external
      SMTP["SMTP Email"]:::external
    end

    %% Connections
    ClientApp --> AuthContext
    AuthContext --> FirebaseFrontInit
    ClientApp --> CodeEditor
    ClientApp --> SocketClient
    ClientApp --> VideoChatUI
    ClientApp -->|HTTP| ExpressServer
    SocketClient <--> SocketServer
    ExpressServer --> DBConfig
    DBConfig --> MongoAtlas
    ExpressServer --> FirebaseAdmin
    ExpressServer --> AuthController
    AuthController --> AuthRoutes
    ExpressServer --> StreamRoutes
    ExpressServer --> JWTUtil
    ExpressServer --> ZodSchema
    ExpressServer --> EmailService
    ExpressServer -->|calls| Gemini
    ExpressServer -->|calls| Piston
    ExpressServer -->|uses| StreamSvc
    ExpressServer -->|sends| SMTP

    %% Click Events
    click ClientApp "https://github.com/bhavish2005/fixmate-cc-ide/tree/main/CollabrativeCodeEditor/"
    click CodeEditor "https://github.com/bhavish2005/fixmate-cc-ide/blob/main/CollabrativeCodeEditor/src/components/CodeEditor.jsx"
    click SocketClient "https://github.com/bhavish2005/fixmate-cc-ide/blob/main/CollabrativeCodeEditor/src/socket.js"
    click VideoChatUI "https://github.com/bhavish2005/fixmate-cc-ide/blob/main/CollabrativeCodeEditor/src/utils/streamClient.js"
    click AuthContext "https://github.com/bhavish2005/fixmate-cc-ide/blob/main/CollabrativeCodeEditor/src/context/AuthContext.jsx"
    click FirebaseFrontInit "https://github.com/bhavish2005/fixmate-cc-ide/blob/main/CollabrativeCodeEditor/src/firebase.js"
    click ExpressServer "https://github.com/bhavish2005/fixmate-cc-ide/blob/main/codeeditor-backend/index.js"
    click SocketServer "https://github.com/bhavish2005/fixmate-cc-ide/blob/main/codeeditor-backend/socket.js"
    click DBConfig "https://github.com/bhavish2005/fixmate-cc-ide/blob/main/codeeditor-backend/src/config/db.js"
    click FirebaseAdmin "https://github.com/bhavish2005/fixmate-cc-ide/blob/main/codeeditor-backend/src/config/firebaseAdmin.js"
    click AuthController "https://github.com/bhavish2005/fixmate-cc-ide/blob/main/codeeditor-backend/src/controllers/auth.controller.js"
    click AuthRoutes "https://github.com/bhavish2005/fixmate-cc-ide/blob/main/codeeditor-backend/src/routes/auth.routes.js"
    click StreamRoutes "https://github.com/bhavish2005/fixmate-cc-ide/blob/main/codeeditor-backend/src/routes/stream.routes.js"
    click UserModel "https://github.com/bhavish2005/fixmate-cc-ide/blob/main/codeeditor-backend/src/models/user.model.js"
    click ErrorModel "https://github.com/bhavish2005/fixmate-cc-ide/blob/main/codeeditor-backend/src/models/error.model.js"
    click JWTUtil "https://github.com/bhavish2005/fixmate-cc-ide/blob/main/codeeditor-backend/src/utils/jwt-setup.js"
    click ZodSchema "https://github.com/bhavish2005/fixmate-cc-ide/blob/main/codeeditor-backend/src/utils/zod-schema.js"
    click EmailService "https://github.com/bhavish2005/fixmate-cc-ide/blob/main/codeeditor-backend/src/utils/sendEmail.js"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366d6,color:#024b94
    classDef backend fill:#DFFFD6,stroke:#28a745,color:#176f1d
    classDef database fill:#FFE4B3,stroke:#db8b00,color:#8b5a00
    classDef external fill:#FFD6D6,stroke:#d73a49,color:#831923
```
