# juanitacathy/devorbit architecture

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

- Interactive diagram: https://gitdiagram.com/juanitacathy/devorbit
- Repository: https://github.com/juanitacathy/devorbit

## Overview

##### Main Components

a) Client-Side (Next.js Frontend):
- Authentication Layer (Google OAuth)
- Room Management UI
- Real-time Components (Video, Chat, Whiteboard)
- Theme System
- Component Library (UI components in src/components)

b) Server-Side:
- Next.js API Routes
- Authentication Service
- WebSocket Server (Socket.io)
- Stream.io Integration

c) Database Layer:
- PostgreSQL Database (with Drizzle ORM)
- Schema relationships for:
- Users
- Rooms
- Sessions

d) External Services:
- Google OAuth
- getStream.io
- Excalidraw Integration

##### Connection Flows

- Client → Authentication Flow
- Client ↔ WebSocket Server (real-time communications)
- Client ↔ Stream.io (video meetings)
- Backend ↔ Database
- Client ↔ Excalidraw

##### Specific Implementation Details

Technical stack indicators:
- Next.js
- TypeScript
- Socket.io
- PostgreSQL
- Drizzle ORM
- Three.js

##### Key Architectural Patterns to Highlight

- Server-Side Rendering (Next.js)
- Real-time Communication Channels
- API Routes Structure
- Database Access Layer (src/data-access)
- Component Composition

##### Additional Elements

Create sections showing:
- Security Layer (middleware, authentication)
- State Management
- File Structure Organization
- API Endpoints

##### Security implementation

Special Considerations:

- How the room-based features (video, chat, whiteboard) interact
- Scalability considerations mentioned in the README
- Task management and timer feature integrations
- Demonstrate how the tag-based room filtering system works

- Component types
- External service integrations

Keep the abstraction level high enough to understand the system architecture but detailed enough to show the unique features of DevOrbit, particularly its real-time collaboration capabilities and room-based structure.

Remember to indicate potential scaling points and performance optimization areas, especially regarding the Three.js implementation mentioned in the README.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Frontend["Next.js Frontend"]
        Auth["Authentication Layer"]:::auth
        RoomUI["Room Management UI"]:::frontend
        RealTime["Real-time Components"]:::frontend
        Theme["Theme System"]:::frontend
        CompLib["Component Library"]:::frontend
        
        Frontend --> Auth
        Frontend --> RoomUI
        Frontend --> RealTime
        Frontend --> Theme
        Frontend --> CompLib
        
        subgraph RoomFeatures
            Timer["Timer"]:::frontend
            TaskList["Task List"]:::frontend
            TagSystem["Tag System"]:::frontend
        end
        
        RoomUI --> RoomFeatures
    end
    
    subgraph Server
        API["Next.js API Routes"]:::backend
        AuthService["Authentication Service"]:::auth
        WebSocket["WebSocket Server"]:::backend
        StreamIO["Stream.io Integration"]:::external
    end
    
    subgraph Database
        PostgreSQL[(PostgreSQL)]:::database
        DrizzleORM["Drizzle ORM"]:::database
        
        subgraph Schema
            Users[("Users")]:::database
            Rooms[("Rooms")]:::database
            Sessions[("Sessions")]:::database
        end
        
        DrizzleORM --> PostgreSQL
        PostgreSQL --> Schema
    end
    
    subgraph ExternalServices
        GoogleOAuth["Google OAuth"]:::external
        StreamService["getStream.io"]:::external
        Excalidraw["Excalidraw"]:::external
    end
    
    %% Connections
    Auth <--> AuthService
    AuthService <--> GoogleOAuth
    RealTime <--> WebSocket
    RealTime <--> StreamIO
    StreamIO <--> StreamService
    RoomUI <--> Excalidraw
    API <--> DrizzleORM
    
    %% Click Events
    click Auth "https://github.com/JuanitaCathy/DevOrbit/blob/main/src/lib/auth.ts"
    click AuthService "https://github.com/JuanitaCathy/DevOrbit/blob/main/src/app/api/auth/[...nextauth]/route.ts"
    click RoomUI "https://github.com/JuanitaCathy/DevOrbit/tree/main/src/app/rooms/[roomId]"
    click RealTime "https://github.com/JuanitaCathy/DevOrbit/blob/main/src/components/chat-widget.tsx"
    click Theme "https://github.com/JuanitaCathy/DevOrbit/blob/main/src/components/theme-provider.tsx"
    click CompLib "https://github.com/JuanitaCathy/DevOrbit/tree/main/src/components/ui"
    click PostgreSQL "https://github.com/JuanitaCathy/DevOrbit/blob/main/src/db/schema.ts"
    click DrizzleORM "https://github.com/JuanitaCathy/DevOrbit/blob/main/src/db/index.ts"
    click WebSocket "https://github.com/JuanitaCathy/DevOrbit/blob/main/src/backend/src/index.ts"
    click Excalidraw "https://github.com/JuanitaCathy/DevOrbit/blob/main/src/lib/excalidraw.ts"
    click Timer "https://github.com/JuanitaCathy/DevOrbit/blob/main/src/components/timer.tsx"
    click TaskList "https://github.com/JuanitaCathy/DevOrbit/blob/main/src/components/task-list.tsx"
    click TagSystem "https://github.com/JuanitaCathy/DevOrbit/blob/main/src/components/tags-list.tsx"
    
    %% Styles
    classDef frontend fill:#2196F3,color:white
    classDef backend fill:#4CAF50,color:white
    classDef external fill:#FFC107,color:black
    classDef database fill:#9C27B0,color:white
    classDef auth fill:#F44336,color:white
    
    %% Legend
    subgraph Legend
        Frontend_L["Frontend"]:::frontend
        Backend_L["Backend"]:::backend
        External_L["External Services"]:::external
        Database_L["Database"]:::database
        Auth_L["Authentication"]:::auth
    end
```
