# nandorojo/you2txt architecture

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

- Interactive diagram: https://gitdiagram.com/nandorojo/you2txt
- Repository: https://github.com/nandorojo/you2txt

## Overview

##### Main System Components

a) Frontend Layer (Next.js Application)
- Client-side UI components (src/components/ui/*)
- Page components (src/app/*)
- Custom hooks (src/hooks/*)

b) API Layer (Next.js API Routes)
- YouTube video processing (src/app/[...url]/youtube.ts)
- Route handling (src/app/[...url]/route.ts)

c) External Services
- YouTube API (for video fetching)
- Vercel Edge Functions/Lambda (for serverless execution)
- v0 (for AI processing)

##### Component Relationships

**[Client Browser] ←→ [Next.js Frontend]**
- ↓
- [API Routes]
- ↓
- [External Services]
- YouTube API
- v0 AI Service

##### Detailed Component Breakdown

Frontend (Blue components):
- Page router structure
- Custom hooks integration

API Layer (Green components):
- API route handling flow
- YouTube video processing pipeline
- Text transformation process

External Services (Purple components):
- YouTube API connection
- v0 AI service integration
- Vercel deployment infrastructure

##### Technical Stack Callouts

Technology badges for:
- Next.js
- Tailwind CSS
- shadcn/ui
- v0
- Claude AI

##### Specific Implementation Details

Create sections showing:
- Route handling logic
- YouTube video processing
- Transcription pipeline
- File delivery mechanism

##### Architecture Patterns

Highlight:
- Server-side rendering with Next.js
- API route architecture
- Component composition pattern
- Hook-based state management

- Version/technology badges
- Error handling paths
- Rate limiting considerations

Remember to:
- Keep the main flow clear and centered
- Related components
- Scalability points
- Potential bottlenecks (YouTube rate limiting)
- Monitoring/logging points

## Diagram (Mermaid)

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

    subgraph "Frontend Layer"
        UI["UI Components"]
        click UI "https://github.com/nandorojo/you2txt/tree/master/src/components/ui"
        Pages["Page Components"]
        click Pages "https://github.com/nandorojo/you2txt/tree/master/src/app"
        Hooks["Custom Hooks"]
        click Hooks "https://github.com/nandorojo/you2txt/tree/master/src/hooks"
        Layout["Layout Component"]
        click Layout "https://github.com/nandorojo/you2txt/blob/master/src/app/layout.tsx"
        MainPage["Main Page"]
        click MainPage "https://github.com/nandorojo/you2txt/blob/master/src/app/page.tsx"
        HistoryPage["History Page"]
        click HistoryPage "https://github.com/nandorojo/you2txt/blob/master/src/app/history.tsx"
        Logo["Logo Components"]
        click Logo "https://github.com/nandorojo/you2txt/blob/master/src/app/logo.tsx"
    end

    subgraph "API Layer"
        RouteHandler["Route Handler"]
        click RouteHandler "https://github.com/nandorojo/you2txt/blob/master/src/app/[...url]/route.ts"
        YouTubeProcessor["YouTube Processor"]
        click YouTubeProcessor "https://github.com/nandorojo/you2txt/blob/master/src/app/[...url]/youtube.ts"
        Utils["Utility Functions"]
        click Utils "https://github.com/nandorojo/you2txt/blob/master/src/lib/utils.ts"
    end

    subgraph "External Services"
        YouTube["YouTube API"]
        V0["v0 AI Service"]
        Vercel["Vercel Edge Functions"]
    end

    subgraph "Configuration"
        NextConfig["Next.js Config"]
        click NextConfig "https://github.com/nandorojo/you2txt/blob/master/next.config.ts"
        TailwindConfig["Tailwind Config"]
        click TailwindConfig "https://github.com/nandorojo/you2txt/blob/master/tailwind.config.ts"
        TSConfig["TypeScript Config"]
        click TSConfig "https://github.com/nandorojo/you2txt/blob/master/tsconfig.json"
        AppConfig["App URL Config"]
        click AppConfig "https://github.com/nandorojo/you2txt/blob/master/src/app/APP_URL.tsx"
    end

    Browser --> Layout
    Layout --> MainPage
    Layout --> HistoryPage
    Layout --> Logo
    MainPage --> UI
    HistoryPage --> UI
    UI --> Hooks
    MainPage --> RouteHandler
    RouteHandler --> YouTubeProcessor
    YouTubeProcessor --> Utils
    YouTubeProcessor --> YouTube
    RouteHandler --> V0
    RouteHandler --> Vercel

    classDef frontend fill:#e1f5fe,stroke:#01579b
    classDef api fill:#e8f5e9,stroke:#1b5e20
    classDef external fill:#f3e5f5,stroke:#4a148c
    classDef config fill:#fff3e0,stroke:#e65100

    class UI,Pages,Hooks,Layout,MainPage,HistoryPage,Logo frontend
    class RouteHandler,YouTubeProcessor,Utils api
    class YouTube,V0,Vercel external
    class NextConfig,TailwindConfig,TSConfig,AppConfig config
```
