# bhancockio/youtube-idea-generator-nextjs architecture

> Architecture diagram of the GitHub repository bhancockio/youtube-idea-generator-nextjs, 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/bhancockio/youtube-idea-generator-nextjs
- Repository: https://github.com/bhancockio/youtube-idea-generator-nextjs

## Overview

##### Main Components

A. Frontend Layer:
- Pages (app directory structure)
- Home Page (page.tsx)
- Videos Page
- Video Detail Page
- Ideas Page
- Components Layer
- UI Components (shadcn/ui components)
- Custom Components (VideoList, VideoDetail, IdeaList, etc.)
- Client-side Hooks

B. Server Layer:
- Server Actions
- Ideas Actions
- YouTube Actions
- Mutations
- Queries
- API Routes/Handlers

C. Database Layer:
- A "Database" section showing:
- Drizzle ORM
- Database Schema
- Database Connections

D. External Services:
- A "Third-party Services" section:
- YouTube API Integration

##### Component Relationships

- Client Components → Server Actions (data mutations)
- Server Components → Database (data queries)
- Server Actions → External Services (YouTube API calls)
- Pages → Components (composition)

##### Specific Implementation Details

Architectural elements:
- Next.js App Router Structure
- Server-side Rendering Flow
- Client-side State Management
- Database Schema Relationships
- API Integration Points

**[Client Layer (Browser)]**
- ↕
**[Next.js App Router]**
- ↕
**[Server Components/Actions]**
- ↕
**[Database Layer]**
- ↕
**[External Services]**

##### Additional Elements

Supporting components:
- Middleware (authentication/authorization)
- Static Assets (public directory)
- Configuration Files
- Build/Deploy Pipeline

##### Technical Stack Callouts

Key technologies:
- Next.js 13+ (App Router)
- TypeScript
- Tailwind CSS
- Drizzle ORM
- shadcn/ui Components

Remember to:
- Use consistent symbols and notation
- Brief annotations for complex interactions
- Both synchronous and asynchronous flows
- Data flow directions clearly

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        Browser["Web Browser"]
        Pages["Pages Layer"]
        CustomComps["Custom Components"]
        UIComps["UI Components"]
        ClientHooks["Client Hooks"]
    end

    subgraph Server
        ServerActions["Server Actions"]
        APIHandlers["API Handlers"]
        Middleware["Middleware"]
    end

    subgraph Database
        DrizzleORM["Drizzle ORM"]
        DBSchema["Database Schema"]
        DBConn["Database Connection"]
    end

    subgraph External
        YouTubeAPI["YouTube API"]
    end

    %% Relationships
    Browser --> Pages
    Pages --> CustomComps
    Pages --> UIComps
    CustomComps --> ClientHooks
    CustomComps --> ServerActions
    ServerActions --> DrizzleORM
    ServerActions --> YouTubeAPI
    APIHandlers --> DrizzleORM
    DrizzleORM --> DBSchema
    DrizzleORM --> DBConn
    Middleware --> ServerActions

    %% Styling
    classDef frontend fill:#3b82f6,color:#fff
    classDef server fill:#22c55e,color:#fff
    classDef database fill:#eab308,color:#fff
    classDef external fill:#a855f7,color:#fff
    classDef config fill:#64748b,color:#fff

    class Browser,Pages,CustomComps,UIComps,ClientHooks frontend
    class ServerActions,APIHandlers,Middleware server
    class DrizzleORM,DBSchema,DBConn database
    class YouTubeAPI external

    %% Click Events
    click Pages "https://github.com/bhancockio/youtube-idea-generator-nextjs/tree/main/app"
    click CustomComps "https://github.com/bhancockio/youtube-idea-generator-nextjs/tree/main/components"
    click UIComps "https://github.com/bhancockio/youtube-idea-generator-nextjs/tree/main/components/ui"
    click ClientHooks "https://github.com/bhancockio/youtube-idea-generator-nextjs/tree/main/hooks"
    click ServerActions "https://github.com/bhancockio/youtube-idea-generator-nextjs/tree/main/server"
    click Middleware "https://github.com/bhancockio/youtube-idea-generator-nextjs/blob/main/middleware.ts"
    click DrizzleORM "https://github.com/bhancockio/youtube-idea-generator-nextjs/blob/main/drizzle.config.ts"
    click DBSchema "https://github.com/bhancockio/youtube-idea-generator-nextjs/blob/main/server/db/schema.ts"
    click DBConn "https://github.com/bhancockio/youtube-idea-generator-nextjs/blob/main/server/db/drizzle.ts"

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        ServerComp["Server Component"]:::server
        DatabaseComp["Database Component"]:::database
        ExternalComp["External Service"]:::external
    end
```
