# jitendra39/the-dev-sphere architecture

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

- Interactive diagram: https://gitdiagram.com/jitendra39/the-dev-sphere
- Repository: https://github.com/jitendra39/the-dev-sphere

## Overview

##### Main Components

Frontend Layer:
- Client-Side Components (React/Next.js)
- Public Pages (Home, Courses, Contact Us)
- Authentication Pages
- Admin Dashboard
- Course Player
- UI Components

Backend Layer:
- Next.js API Routes
- Course Management
- Video Streaming
- Authentication
- Email Services
- Referral System

External Services:
- Supabase (Database/Authentication)
- Firebase (indicated by firebaseConfig.js)
- Email Service Provider

**┌─────────────────────────────────────────────────────────────┐**
- Client Layer                           │
- ┌─────────────┐  ┌─────────────┐  ┌─────────────┐        │
- Public     │  │ Protected   │  │   Admin     │        │
- Pages     │  │   Pages     │  │  Dashboard  │        │
- ┘  └─────────────┘  └─────────────┘        │
- ┘

**┌───────────────────────────────────────────│──────────────┐**
- Application Layer       │              │
- ┌─────────────┐  ┌─────────────┐  ┌─────│───────┐      │
- Next.js   │  │  Context &  │  │   Route     │      │
- Router    │  │   State     │  │  Handlers   │      │
- ┘  └─────────────┘  └─────────────┘      │
- ┘

**┌───────────────────────────────────────────│───────────┐**
- API Layer              │           │
- ┌─────────────┐  ┌─────────────┐  ┌─────│───────┐   │
- Course    │  │   Video     │  │   Auth      │   │
- API      │  │ Streaming   │  │   API       │   │
- ┘  └─────────────┘  └─────────────┘   │
- ┘

**┌───────────────────────────────────────────│────────┐**
- External Services         │        │
- ┌─────────────┐  ┌─────────────┐  ┌─────────────┐│
- Supabase   │  │  Firebase   │  │   Email     ││
- Database   │  │  Services   │  │  Service    ││
- ┘  └─────────────┘  └─────────────┘│
- ┘

##### Important Elements to Highlight

a. Authentication Flow:
- Interaction between MAuth component, Auth API, and Supabase/Firebase

b. Course Management:
- Flow from Course components to Course API to database
- Video streaming architecture

c. State Management:
- GlobalContext and its connections to components

##### Technical Stack Indicators

- Next.js 13+ (App Router)
- Tailwind CSS
- Supabase
- Firebase
- React Components
- API Routes

##### Special Features to Highlight

- Video streaming capabilities
- Referral system
- Admin dashboard
- Email notification system
- File upload functionality

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        PublicPages["Public Pages"]
        ProtectedPages["Protected Pages"]
        AdminDash["Admin Dashboard"]
        CoursePlayer["Course Player"]
        UIComponents["UI Components"]
    end

    subgraph AppLayer
        NextRouter["Next.js Router"]
        GlobalState["Global Context"]
        RouteHandlers["Route Handlers"]
    end

    subgraph APILayer
        CourseAPI["Course API"]
        VideoAPI["Video Streaming API"]
        AuthAPI["Auth API"]
        EmailAPI["Email Service API"]
        ReferralAPI["Referral API"]
    end

    subgraph ExternalServices
        Supabase[(Supabase DB)]
        Firebase[(Firebase)]
        EmailService["Email Provider"]
    end

    %% Connections
    PublicPages --> NextRouter
    ProtectedPages --> NextRouter
    AdminDash --> NextRouter
    CoursePlayer --> NextRouter

    NextRouter --> GlobalState
    NextRouter --> RouteHandlers

    RouteHandlers --> CourseAPI
    RouteHandlers --> VideoAPI
    RouteHandlers --> AuthAPI
    RouteHandlers --> EmailAPI
    RouteHandlers --> ReferralAPI

    CourseAPI --> Supabase
    VideoAPI --> Firebase
    AuthAPI --> Supabase
    EmailAPI --> EmailService
    ReferralAPI --> Supabase

    %% Styling
    classDef frontend fill:#a8d5ff
    classDef backend fill:#98ff98
    classDef external fill:#ffa07a
    classDef api fill:#dda0dd

    class PublicPages,ProtectedPages,AdminDash,CoursePlayer,UIComponents frontend
    class NextRouter,GlobalState,RouteHandlers backend
    class CourseAPI,VideoAPI,AuthAPI,EmailAPI,ReferralAPI api
    class Supabase,Firebase,EmailService external

    %% Click Events
    click PublicPages "https://github.com/Jitendra39/The-Dev-Sphere/blob/main/app/(root)/page.js"
    click AdminDash "https://github.com/Jitendra39/The-Dev-Sphere/blob/main/app/admin/[params]/page.js"
    click CoursePlayer "https://github.com/Jitendra39/The-Dev-Sphere/blob/main/components/courses/player.jsx"
    click GlobalState "https://github.com/Jitendra39/The-Dev-Sphere/blob/main/context/GlobalContext.jsx"
    click CourseAPI "https://github.com/Jitendra39/The-Dev-Sphere/blob/main/app/api/Courses/route.js"
    click VideoAPI "https://github.com/Jitendra39/The-Dev-Sphere/blob/main/app/api/streaming/route.js"
    click AuthAPI "https://github.com/Jitendra39/The-Dev-Sphere/blob/main/components/Auth/authLogic.jsx"
    click EmailAPI "https://github.com/Jitendra39/The-Dev-Sphere/blob/main/app/api/sendMail/route.js"
    click ReferralAPI "https://github.com/Jitendra39/The-Dev-Sphere/blob/main/app/api/referDatabase/route.js"
    click Firebase "https://github.com/Jitendra39/The-Dev-Sphere/blob/main/firebaseConfig.js"
    click UIComponents "https://github.com/Jitendra39/The-Dev-Sphere/tree/main/components/ui"

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Component"]:::backend
        API["API Route"]:::api
        External["External Service"]:::external
    end
```
