# suyashagnihotri/course-platform architecture

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

- Interactive diagram: https://gitdiagram.com/suyashagnihotri/course-platform
- Repository: https://github.com/suyashagnihotri/course-platform

## Overview

##### Project type and purpose
- This is a full-stack, React-based course platform built on Next.js (the presence of `app/` directory, `next.config.mjs`, Tailwind, and page.tsx files).
- Its purpose is to let students browse and enroll in courses, and let instructors create and manage courses. It also handles authentication and payment history.

##### File structure
- Top-level directories:
- `app/` – Next.js “app” routes and server-rendered pages (frontend + server logic).
- `components/` – a shared UI component library (buttons, forms, navigation, theme provider, payment modal, etc.).
- `hooks/` – custom React hooks for UI and state (mobile detection, toast notifications, intersection observer, etc.).
- `lib/` – business logic and data layers (authentication wrappers, data fetching, mock data, payment integration, shared types, utilities).
- `utils/` – low-level DOM or animation helpers.
- `public/`, `styles/`, config files – static assets and build configurations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client Browser"
        Browser["Web Browser"]
    end

    subgraph "Next.js Server"
        Server["Next.js App Server"]:::backend
        subgraph "App Routes (app/)"
            PublicPages["Public Pages"]:::frontend
            AuthUI["Authentication UI"]:::frontend
            CourseUI["Course Browsing & Details"]:::frontend
            StudentDash["Student Dashboard"]:::frontend
            InstructorUI["Instructor Interface"]:::frontend
        end
    end

    subgraph "UI Component Library"
        UIComp["components/ & components/ui/"]:::frontend
        ThemeNav["Global Theming & Navigation"]:::frontend
        PaymentUI["Payment UI Components"]:::frontend
    end

    subgraph "Custom Hooks"
        Hooks["hooks/..."]:::hook
    end

    subgraph "Backend Logic (lib/)"
        AuthLogic["Authentication Logic"]:::backend
        DataLayer["Data Layer & DB Access"]:::backend
        MockData["Mock Data"]:::backend
        PaymentLogic["Payment Integration Logic"]:::backend
        SharedUtil["Shared Types & Utilities"]:::backend
    end

    subgraph "Data Stores & External"
        DB["Database"]:::datastore
        PaymentService["Payment Gateway"]:::external
    end

    subgraph "Static Assets & Config"
        StaticAssets["Static Assets & Styles"]:::util
        NextConfig["Next.js Configuration"]:::util
        Package["Package Management"]:::util
    end

    Browser -->|HTTP GET/POST| Server
    Server -->|renders HTML/JSON| Browser
    Server -->|uses UI Components| UIComp
    Server -->|uses Hooks| Hooks
    UIComp -->|provides components to| Browser
    Hooks -->|client behaviors| Browser
    Server -->|calls| AuthLogic
    Server -->|calls| DataLayer
    Server -->|calls| PaymentLogic
    AuthLogic -->|session/cookies| DB
    DataLayer -->|SQL/ORM| DB
    Server -->|calls| PaymentService
    StaticAssets -->|serves assets to| Browser

    click Server "https://github.com/suyashagnihotri/course-platform/tree/main/app/"
    click PublicPages "https://github.com/suyashagnihotri/course-platform/blob/main/app/page.tsx"
    click AuthUI "https://github.com/suyashagnihotri/course-platform/blob/main/app/auth/signin/page.tsx"
    click CourseUI "https://github.com/suyashagnihotri/course-platform/blob/main/app/courses/page.tsx"
    click StudentDash "https://github.com/suyashagnihotri/course-platform/blob/main/app/dashboard/page.tsx"
    click InstructorUI "https://github.com/suyashagnihotri/course-platform/blob/main/app/instructor/page.tsx"
    click UIComp "https://github.com/suyashagnihotri/course-platform/tree/main/components/"
    click ThemeNav "https://github.com/suyashagnihotri/course-platform/blob/main/components/theme-provider.tsx"
    click PaymentUI "https://github.com/suyashagnihotri/course-platform/blob/main/components/payment/payment-modal.tsx"
    click Hooks "https://github.com/suyashagnihotri/course-platform/blob/main/hooks/use-mobile.tsx"
    click AuthLogic "https://github.com/suyashagnihotri/course-platform/blob/main/lib/auth/index.tsx"
    click DataLayer "https://github.com/suyashagnihotri/course-platform/blob/main/lib/data.ts"
    click MockData "https://github.com/suyashagnihotri/course-platform/blob/main/lib/mock-data.ts"
    click PaymentLogic "https://github.com/suyashagnihotri/course-platform/blob/main/lib/payment.ts"
    click SharedUtil "https://github.com/suyashagnihotri/course-platform/blob/main/lib/types.ts"
    click StaticAssets "https://github.com/suyashagnihotri/course-platform/tree/main/public/"
    click NextConfig "https://github.com/suyashagnihotri/course-platform/blob/main/next.config.mjs"
    click Package "https://github.com/suyashagnihotri/course-platform/blob/main/package.json"

    classDef frontend fill:#D6E9FF,stroke:#3399FF,color:#000
    classDef backend fill:#D6FFD6,stroke:#33AA33,color:#000
    classDef datastore fill:#FFECD6,stroke:#FF9900,color:#000
    classDef external fill:#FFD6D6,stroke:#FF3333,color:#000
    classDef hook fill:#EDEDED,stroke:#AAAAAA,color:#000
    classDef util fill:#F2F2F2,stroke:#888888,color:#000
```
