# rohanprasad007/collabdev architecture

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

- Interactive diagram: https://gitdiagram.com/rohanprasad007/collabdev
- Repository: https://github.com/rohanprasad007/collabdev

## Overview

##### Project Type and Purpose
- CollabDev is a full-stack, cross-platform collaborative development platform.
- It provides a Next.js-based website and an Electron/React-based desktop application, both using Firebase for authentication, real-time chat, file storage, and WebRTC for video calls.

##### File Structure
- Top level:
- pc/ – Electron desktop app (React CRA structure: public/, src/, firebase.js)
- website/ – Next.js v13 app (app/ directory with server/client components, pages under /app, plus components/, context/, model/, services/)
- doc/ – demo assets (video, screenshots)
- Key patterns:
- Both frontends share a component, context, model, service and utils layer for consistent UI/UX and business logic.
- pc/ uses a preload script to expose Node/Electron APIs to React.
- website/ uses Next.js server/client boundary, React Context API, and Webpack/static build.
- Configuration files point to Firebase and Tailwind CSS for styling.

##### README for Additional Insights
- Features: Google login (Firebase Auth), 1:1 WebRTC video calls, encrypted chat & file sharing (Firestore + Storage), task boards (Firestore), cross-platform desktop & web.
- Deployment:
- website runs on `npm run dev` under localhost:3000
- desktop runs via Electron’s development server

##### Elements
- Clear labels: e.g., “Next.js App”, “Electron Main”, “Firebase Auth”, “Firestore DB”.
- Authentication requests/responses
- Read/write operations to Firestore
- File upload/download to Storage
- WebRTC signaling and peer streams
- External APIs (gray)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer - Website
    subgraph "Web (Next.js)" 
        direction TB
        WebUI["UI Components"]:::frontend
        WebContext["React Context"]:::frontend
        WebServices["Service Layer"]:::frontend
        WebUtils["Utils (DB & Signaling)"]:::frontend
        WebModels["Data Models"]:::frontend
    end

    %% Frontend Layer - Desktop
    subgraph "Desktop (Electron)" 
        direction TB
        ElectronMain["Main Process"]:::frontend
        Preload["Preload Script"]:::frontend
        subgraph "Renderer (React)"
            direction TB
            DesktopUI["UI Components"]:::frontend
            DesktopContext["React Context"]:::frontend
            DesktopServices["Service Layer"]:::frontend
            DesktopUtils["Utils (DB & Signaling)"]:::frontend
            DesktopModels["Data Models"]:::frontend
        end
    end

    %% Backend Layer - Firebase
    subgraph "Firebase Backend"
        direction TB
        Auth["Firebase Auth"]:::backend
        Firestore["Firestore DB"]:::backend
        Storage["Firebase Storage"]:::backend
    end

    %% External Services
    GoogleOAuth["Google OAuth Endpoint"]:::external

    %% Communication Flows
    WebUI -->|uses| WebContext
    WebContext -->|calls| WebServices
    WebServices -->|auth via SDK| Auth
    WebServices -->|read/write| Firestore
    WebServices -->|upload/download| Storage
    WebServices -->|exchange signals| WebUtils
    WebUtils -->|firestore listener| Firestore
    WebUtils -->|webrtc signaling| Firestore
    WebUtils -->|peer streams| WebUI

    DesktopUI -->|uses| DesktopContext
    DesktopContext -->|calls| DesktopServices
    DesktopServices -->|auth via SDK| Auth
    DesktopServices -->|read/write| Firestore
    DesktopServices -->|upload/download| Storage
    DesktopServices -->|exchange signals| DesktopUtils
    DesktopUtils -->|firestore listener| Firestore
    DesktopUtils -->|webrtc signaling| Firestore
    DesktopUtils -->|peer streams| DesktopUI
    ElectronMain -->|inject APIs| Preload
    Preload -->|exposes Node APIs| DesktopUI

    Auth -->|OAuth flow| GoogleOAuth

    %% Click Events - Website
    click WebUI "https://github.com/rohanprasad007/collabdev/tree/main/website/components/"
    click WebContext "https://github.com/rohanprasad007/collabdev/tree/main/website/context/"
    click WebServices "https://github.com/rohanprasad007/collabdev/blob/main/website/services/databaseService.js"
    click WebUtils "https://github.com/rohanprasad007/collabdev/blob/main/website/utils/database.js"
    click WebModels "https://github.com/rohanprasad007/collabdev/tree/main/website/model/"
    click Auth "https://github.com/rohanprasad007/collabdev/blob/main/website/config.js"

    %% Click Events - Desktop
    click DesktopUI "https://github.com/rohanprasad007/collabdev/tree/main/pc/src/components/"
    click DesktopContext "https://github.com/rohanprasad007/collabdev/tree/main/pc/src/context/"
    click DesktopServices "https://github.com/rohanprasad007/collabdev/blob/main/pc/src/services/databaseService.js"
    click DesktopUtils "https://github.com/rohanprasad007/collabdev/blob/main/pc/src/utils/database.js"
    click DesktopModels "https://github.com/rohanprasad007/collabdev/tree/main/pc/src/model/"
    click Preload "https://github.com/rohanprasad007/collabdev/blob/main/pc/public/preload.js"
    click Auth "https://github.com/rohanprasad007/collabdev/blob/main/pc/src/firebase.js"

    %% Styles
    classDef frontend fill:#D6EAF8,stroke:#3498DB,color:#1B4F72
    classDef backend fill:#D5F5E3,stroke:#27AE60,color:#145A32
    classDef external fill:#EEEEEE,stroke:#95A5A6,color:#626567
```
