# amanyadav2205/ai_course_generator architecture

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

- Interactive diagram: https://gitdiagram.com/amanyadav2205/ai_course_generator
- Repository: https://github.com/amanyadav2205/ai_course_generator

## Overview

##### Main Components

Frontend Layer:
- Client-Side Components (React/Next.js)
- Public Pages (Landing, Authentication)
- Dashboard Area
- Course Creation Interface
- Course Viewing Interface

Backend Layer:
- Next.js API Routes
- Authentication System
- Database Layer
- AI Integration (indicated by AiModel.jsx in configs)

##### Component Relationships

a) User Interface Layer (Top):
- Public Area (Landing Page, Features, Pricing)
- Auth Area (Sign-in/Sign-up)
- Dashboard
- Course Creation
- Course Viewing

b) Application Layer (Middle):
- Next.js Server Components
- API Routes
- Context Providers (UserInputContext)
- Authentication Middleware

c) Data Layer (Bottom):
- Database (indicated by db.jsx in configs)
- File Storage (for course content)
- External Services

##### Important Flows to Highlight

Authentication Flow:
**User → Auth Pages → Auth Service → Database**

Course Creation Flow:
**Creator → Course Creation Interface → API Routes → Database/Storage**

Course Consumption Flow:
**Student → Course Viewer → Content Delivery → Database/Storage**

##### Technical Stack Indicators

- Next.js
- React
- Tailwind CSS
- Database (specified in schema.jsx)
- Authentication Provider
- Vercel Deployment

##### Additional Elements

- Public vs protected routes
- Scalable components
- Caching layers if applicable

##### Key Relationships to Emphasize

- Authentication flow with protected routes
- Course creation workflow
- Content delivery pipeline
- User dashboard interactions
- Theme system integration

Remember to:
- Use consistent styling
- Version information
- Notes for important architectural decisions
- Both synchronous and asynchronous flows

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "User Interface Layer"
        PUB["Public Interface"]:::public
        AUTH["Authentication System"]:::auth
        DASH["Dashboard Interface"]:::protected
        CCS["Course Creation System"]:::protected
        CVS["Course Viewing System"]:::protected
    end

    subgraph "Application Layer"
        NSC["Next.js Server Components"]:::core
        APR["API Routes"]:::core
        CTX["Context Providers"]:::core
        AMID["Authentication Middleware"]:::core
    end

    subgraph "Data Layer"
        DB[(Database)]:::storage
        FS["File Storage"]:::storage
        EXT["External Services"]:::external
    end

    %% Component Relationships
    PUB --> NSC
    AUTH --> NSC
    DASH --> NSC
    CCS --> NSC
    CVS --> NSC

    NSC --> APR
    APR --> CTX
    CTX --> AMID
    AMID --> DB
    AMID --> FS

    APR --> DB
    APR --> FS
    APR --> EXT

    %% Component Mappings with Click Events
    click PUB "https://github.com/Amanyadav2205/AI_COURSE_GENERATOR/blob/main/app/_components/LandingPage.jsx"
    click AUTH "https://github.com/Amanyadav2205/AI_COURSE_GENERATOR/tree/main/app/(auth)"
    click DASH "https://github.com/Amanyadav2205/AI_COURSE_GENERATOR/tree/main/app/dashboard"
    click CCS "https://github.com/Amanyadav2205/AI_COURSE_GENERATOR/tree/main/app/create-course"
    click CVS "https://github.com/Amanyadav2205/AI_COURSE_GENERATOR/tree/main/app/course/[courseId]"
    click AMID "https://github.com/Amanyadav2205/AI_COURSE_GENERATOR/blob/main/middleware.js"
    click DB "https://github.com/Amanyadav2205/AI_COURSE_GENERATOR/blob/main/configs/db.jsx"
    click CTX "https://github.com/Amanyadav2205/AI_COURSE_GENERATOR/blob/main/app/_context/UserInputContext.jsx"

    %% Styling
    classDef public fill:#3b82f6,color:white
    classDef auth fill:#10b981,color:white
    classDef protected fill:#8b5cf6,color:white
    classDef core fill:#6b7280,color:white
    classDef storage fill:#9333ea,color:white
    classDef external fill:#f97316,color:white

    %% Legend
    subgraph Legend
        L1["Public Components"]:::public
        L2["Auth Components"]:::auth
        L3["Protected Components"]:::protected
        L4["Core Components"]:::core
        L5["Storage Components"]:::storage
        L6["External Services"]:::external
    end
```
