# manthankhawse/interview-platform architecture

> Architecture diagram of the GitHub repository manthankhawse/interview-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/manthankhawse/interview-platform
- Repository: https://github.com/manthankhawse/interview-platform

## Overview

##### Main Components Structure

A. Client Layer (Frontend)
- User Interface Components (Login, Signup, Homepage, MainPage)
- Real-time Components (AudioVideoScreen, CodeEditor, Notepad)
- State Management (Context API - DataProvider)

B. Communication Layer
- Socket.io Connection
- PeerJS WebRTC Connection

C. Server Layer (Backend)
- Authentication Controllers
- Route Handlers
- WebSocket Event Handlers

D. Database Layer
- MongoDB container at the bottom

##### Detailed Component Breakdown

Frontend Section:
**[Frontend Container]**
- User Authentication
- Login Component
- Signup Component
- Interview Interface
- Audio/Video Stream
- Code Editor
- Notepad
- State Management
- Context API

Communication Layer:
**[Real-time Communication]**
- Socket.io Events
- PeerJS WebRTC

Backend Section:
**[Backend Container]**
- Auth Routes
- WebSocket Handlers
- Database Operations

##### Technical Details

Labels for:
- Technologies: React, Node.js, Express, MongoDB
- Protocols: WebSocket, WebRTC, HTTP/HTTPS
- Key libraries: Socket.io, PeerJS
- Authentication flow with JWT

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        UI[User Interface]
        Login["Login"]:::component
        Signup["Signup"]:::component
        Homepage["Homepage"]:::component
        MainPage["MainPage"]:::component
        UI --> Login
        UI --> Signup
        UI --> Homepage
        UI --> MainPage

        RT[Real-time Components]
        AV["AudioVideoScreen"]:::component
        CE["CodeEditor"]:::component
        NP["Notepad"]:::component
        RT --> AV
        RT --> CE
        RT --> NP

        SM[State Management]
        DP["DataProvider"]:::component
        SM --> DP
    end

    subgraph Communication
        SOCK["Socket.io Connection"]
        PEER["PeerJS WebRTC"]
    end

    subgraph Backend
        SRV["Server"]:::component
        AUTH["Auth Controller"]:::component
        ROUTES["Auth Routes"]:::component
        WSH["WebSocket Handlers"]

        SRV --> AUTH
        SRV --> ROUTES
        SRV --> WSH
    end

    subgraph Database
        DB["MongoDB Connection"]:::component
        MODEL["Database Model"]:::component
        DB --> MODEL
    end

    %% Connections
    Frontend <--> |HTTP/REST| Backend
    Frontend <--> |WebSocket| SOCK
    Frontend <--> |WebRTC| PEER
    SOCK <--> Backend
    PEER <--> Backend
    Backend <--> Database

    %% Click Events
    click Login "https://github.com/manthankhawse/Interview-Platform/blob/main/frontend/src/pages/Login.jsx"
    click Signup "https://github.com/manthankhawse/Interview-Platform/blob/main/frontend/src/pages/Signup.jsx"
    click Homepage "https://github.com/manthankhawse/Interview-Platform/blob/main/frontend/src/pages/Homepage.jsx"
    click MainPage "https://github.com/manthankhawse/Interview-Platform/blob/main/frontend/src/pages/MainPage.jsx"
    click AV "https://github.com/manthankhawse/Interview-Platform/blob/main/frontend/src/components/AudioVideoScreen.jsx"
    click CE "https://github.com/manthankhawse/Interview-Platform/blob/main/frontend/src/components/CodeEditor.jsx"
    click NP "https://github.com/manthankhawse/Interview-Platform/blob/main/frontend/src/components/Notepad.jsx"
    click DP "https://github.com/manthankhawse/Interview-Platform/blob/main/frontend/src/context/DataProvider.jsx"
    click AUTH "https://github.com/manthankhawse/Interview-Platform/blob/main/backend/controllers/authControllers.js"
    click ROUTES "https://github.com/manthankhawse/Interview-Platform/blob/main/backend/routes/auth.js"
    click DB "https://github.com/manthankhawse/Interview-Platform/blob/main/backend/db/connectDb.js"
    click MODEL "https://github.com/manthankhawse/Interview-Platform/blob/main/backend/db/model.js"
    click SRV "https://github.com/manthankhawse/Interview-Platform/blob/main/backend/server.js"

    %% Styles
    classDef frontend fill:#a8d1ff
    classDef backend fill:#ffeda8
    classDef database fill:#e6a8ff
    classDef communication fill:#a8ffb3
    classDef component fill:#f9f9f9,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1[Frontend Component]:::frontend
        L2[Backend Component]:::backend
        L3[Database Component]:::database
        L4[Communication Layer]:::communication
    end
```
