# jayesh-2404/ai-pdf-notes-taker architecture

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

- Interactive diagram: https://gitdiagram.com/jayesh-2404/ai-pdf-notes-taker
- Repository: https://github.com/jayesh-2404/ai-pdf-notes-taker

## Overview

##### Main Components

A. Frontend Layer:
- Next.js Application (App Router Architecture)
- Public Pages (/)
- Authentication Pages (/sign-in, /sign-up)
- Dashboard Interface (/dashboard)
- UI Components Layer

B. Backend/API Layer:
- Next.js API Routes
- Convex Backend (Database + Real-time Features)
- PDF Processing Service

C. External Services:
- Authentication Service (implied by auth directory structure)
- File Storage System (indicated by fileStorage.js)
- LangChain Integration (for potential AI/ML features)

##### Component Relationships

**[Client Layer]**
- ↑↓
**[Next.js Server Layer]**
- ↑↓
**[Backend Services Layer]**
- ↑↓
**[Data Storage Layer]**

##### Specific Implementation Details

- Blue: Frontend Components
- Green: API Routes
- Purple: External Services
- Orange: Data Stores

- Double lines: Data streaming

##### Key Elements to Highlight

A. Frontend Architecture:
- App Router Structure (app/ directory)
- Protected Routes (dashboard)
- Authentication Flow
- UI Component Library (components/ui)

B. Backend Services:
- PDF Processing API
- Convex Integration
- LangChain Services
- File Storage System

C. Data Flow:
- User Authentication Flow
- PDF Upload and Processing Pipeline
- Real-time Updates (Convex)

##### Specific Implementation Notes

- Authentication Layer (app/(auth))
- Dashboard Components (app/dashboard/_components)
- API Routes (app/api)
- Convex Backend (convex/)
- UI Components (components/ui)

- User authentication flow
- PDF upload and processing
- Data persistence
- Real-time updates

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        UI["UI Layer"]
        HomePage["Homepage"]:::frontend
        Auth["Authentication Pages"]:::frontend
        Dashboard["Dashboard Interface"]:::frontend
        Components["UI Components"]:::frontend
    end

    subgraph Server
        NextServer["Next.js Server"]
        APIRoutes["API Routes"]:::api
        PDFProcessor["PDF Processing Service"]:::service
        AuthSystem["Authentication System"]:::auth
    end

    subgraph Backend
        Convex["Convex Backend"]:::database
        FileStorage["File Storage System"]:::storage
        LangChain["LangChain Integration"]:::service
        UserMgmt["User Management"]:::service
    end

    %% Client Layer Connections
    UI --> HomePage
    UI --> Auth
    UI --> Dashboard
    UI --> Components

    %% Server Layer Connections
    HomePage --> NextServer
    Auth --> AuthSystem
    Dashboard --> APIRoutes
    APIRoutes --> PDFProcessor
    
    %% Backend Connections
    PDFProcessor --> Convex
    PDFProcessor --> FileStorage
    AuthSystem --> UserMgmt
    UserMgmt --> Convex
    Convex --> LangChain

    %% Click Events
    click Auth "https://github.com/Jayesh-2404/Ai-pdf-notes-taker/tree/main/app/(auth)/"
    click Components "https://github.com/Jayesh-2404/Ai-pdf-notes-taker/tree/main/components/ui/"
    click Dashboard "https://github.com/Jayesh-2404/Ai-pdf-notes-taker/tree/main/app/dashboard/"
    click PDFProcessor "https://github.com/Jayesh-2404/Ai-pdf-notes-taker/blob/main/app/api/pdf-loader/route.js"
    click FileStorage "https://github.com/Jayesh-2404/Ai-pdf-notes-taker/blob/main/convex/fileStorage.js"
    click UserMgmt "https://github.com/Jayesh-2404/Ai-pdf-notes-taker/blob/main/convex/user.js"
    click LangChain "https://github.com/Jayesh-2404/Ai-pdf-notes-taker/tree/main/convex/langchain/"
    click HomePage "https://github.com/Jayesh-2404/Ai-pdf-notes-taker/blob/main/app/page.js"

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef api fill:#2ecc71,stroke:#27ae60,color:white
    classDef service fill:#9b59b6,stroke:#8e44ad,color:white
    classDef database fill:#e67e22,stroke:#d35400,color:white
    classDef storage fill:#f1c40f,stroke:#f39c12,color:black
    classDef auth fill:#e74c3c,stroke:#c0392b,color:white

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        API["API Component"]:::api
        Service["Service Component"]:::service
        DB["Database Component"]:::database
        Storage["Storage Component"]:::storage
        AuthComp["Auth Component"]:::auth
    end
```
