# umarfarzan/ai-course-generator architecture

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

- Interactive diagram: https://gitdiagram.com/umarfarzan/ai-course-generator
- Repository: https://github.com/umarfarzan/ai-course-generator

## Overview

##### Project type and purpose
- This is a full-stack React application built with Next.js (via create-next-app).
- It provides server-side rendering (SSR), API routes, and integrates with Drizzle ORM for database access. Tailwind CSS and PostCSS handle styling.

##### File structure
- Top-level config files: next.config.mjs, drizzle.config.js, postcss.config.mjs, tailwind.config.js, jsconfig.json.
- Framework‐specific: middleware.js (Next.js Edge middleware), next-env.d.ts, components.json (likely custom component registry).
- Standard package files: package.json / package-lock.json.
- No explicit “pages” or “app” folder listed, but README refers to app/page.js (Next.js App Router).

##### README for additional insights
- Uses Next.js’s App Router (app/page.js).
- Font optimization with next/font.
- Built-in dev scripts (npm run dev).
- Deployment target: Vercel.

##### Main components
a. Client (Browser) – React UI rendered by Next.js
b. Next.js Server – SSR engine, App Router, API routes, middleware
c. Styling Pipeline – Tailwind CSS + PostCSS (build step)
d. Drizzle ORM Layer – data-access abstraction
e. Database – relational or other, configured in drizzle.config.js
f. External Services – Google Fonts (via next/font), Vercel deployment/CDN

##### Relationships and interactions
- Browser → HTTP GET → Next.js Server
- Next.js Server invokes middleware.js (Edge) for authentication, redirects, etc.
- Server renders React components (app/page.js) → uses Tailwind CSS classes compiled by PostCSS.
- For data needs, React “use” calls or server API routes → Drizzle ORM → Database.
- next/font fetches optimized fonts from Google but serves them from Vercel’s edge CDN.
- Static assets (if any) served from Vercel’s CDN layer.

##### Architectural patterns and design principles
- App Router / File-system routing for React pages.
- Middleware at edge for cross-cutting concerns (auth, logging).
- ORM pattern (Drizzle) decouples SQL schema from business logic.
- Utility-first CSS (Tailwind) with config-driven purging and theming.
- Zero-config deployment (Vercel) with CDN and edge functions.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Nodes
    Browser["Browser (React UI)"]:::frontend
    VercelCDN["Vercel CDN/Edge"]:::infra
    NextJsServer["Next.js Server (SSR Engine & App Router)"]:::backend
    Middleware["Middleware.js (Edge Auth & Redirects)"]:::backend
    ComponentsReg["components.json (Component Registry)"]:::backend
    NextEnv["next-env.d.ts (Type Definitions)"]:::backend
    PackageJson["package.json (Scripts & Deployment)"]:::backend
    Drizzle["Drizzle ORM Layer"]:::backend
    Database["Database (Configured via drizzle.config.js)"]:::infra
    FontCDN["Font CDN (next/font & Google Fonts)"]:::infra

    subgraph "Styling Pipeline"
        Tailwind["Tailwind CSS"]:::infra
        PostCSS["PostCSS Integration"]:::infra
    end

    %% Connections
    Browser -->|"HTTP Request"| VercelCDN
    VercelCDN -->|"Edge Function"| NextJsServer
    NextJsServer -->|"invoke"| Middleware
    Middleware -->|"forward"| NextJsServer
    NextJsServer -->|"renders via App Router"| Browser
    NextJsServer -->|"uses styling"| Tailwind
    Tailwind -->|"processed by"| PostCSS
    PostCSS -->|"CSS bundle"| NextJsServer
    NextJsServer -->|"queries"| Drizzle
    Drizzle -->|"SQL"| Database
    NextJsServer -->|"fetches fonts"| FontCDN
    FontCDN -->|"serves fonts"| VercelCDN
    VercelCDN -->|"delivers assets"| Browser
    NextJsServer --> ComponentsReg
    NextJsServer --> NextEnv
    NextJsServer --> PackageJson

    %% Click Events
    click NextJsServer "https://github.com/umarfarzan/ai-course-generator/blob/main/next.config.mjs"
    click Middleware "https://github.com/umarfarzan/ai-course-generator/blob/main/middleware.js"
    click Drizzle "https://github.com/umarfarzan/ai-course-generator/blob/main/drizzle.config.js"
    click Tailwind "https://github.com/umarfarzan/ai-course-generator/blob/main/tailwind.config.js"
    click PostCSS "https://github.com/umarfarzan/ai-course-generator/blob/main/postcss.config.mjs"
    click FontCDN "https://github.com/umarfarzan/ai-course-generator/blob/main/next.config.mjs"
    click NextEnv "https://github.com/umarfarzan/ai-course-generator/blob/main/next-env.d.ts"
    click ComponentsReg "https://github.com/umarfarzan/ai-course-generator/blob/main/components.json"
    click PackageJson "https://github.com/umarfarzan/ai-course-generator/blob/main/package.json"

    %% Styles
    classDef frontend fill:#e0f7e9,stroke:#2d6a4f,color:#1b4332
    classDef backend fill:#d0ebff,stroke:#1c7ed6,color:#1864ab
    classDef infra fill:#ffe8cc,stroke:#f08c00,color:#ba3e03
```
