# nutlope/notesgpt architecture

> Architecture diagram of the GitHub repository nutlope/notesgpt, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nutlope/notesgpt
- Repository: https://github.com/nutlope/notesgpt

## Overview

##### Main System Components

a) Client Layer:
- Next.js Frontend (App Router)
- Components hierarchy
- Authentication UI (Clerk)
- Recording Interface

b) Backend Services:
- Convex Backend
- Authentication Service (Clerk)
- AI Services Layer
- Together.ai (LLM & Embeddings)
- Replicate (Whisper transcription)

c) Data Storage:
- Convex Database
- Convex File Storage
- Vector Storage (for embeddings)

##### Component Relationships and Data Flow

**[User Interface Layer]**
- ↑↓
**[Authentication Layer (Clerk)]**
- ↑↓
**[Next.js App Router]**
- ↑↓
**[Convex Backend]**
- ↑↓
**[Service Layer]**
- Together.ai
- Replicate
- File Storage

##### Specific Implementation Details

a) Frontend Architecture:
- App router structure (/dashboard, /record, /recording)
- Component organization (pages, UI components)
- Client-side state management

b) Backend Architecture:
- Convex functions and API endpoints
- File storage system
- Vector search implementation
- Authentication flow

c) AI Pipeline:
- Voice recording flow
- Whisper transcription process
- Together.ai processing (Mixtral model)
- Embedding generation and search

##### Key Interactions to Highlight

- Voice Recording Flow:
- [Recording UI] → [File Storage] → [Whisper] → [Text Processing]

- Action Item Generation:
- [Transcribed Text] → [Together.ai] → [Action Items Storage]

- Search Flow:
- [Search Input] → [Vector Search] → [Embeddings] → [Results]

##### Implementation Notes

- Nested components
- Grouping of related components
- Clear labeling of services and interactions

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        UI[Next.js Frontend]:::frontend
        click UI "https://github.com/nutlope/notesGPT/tree/main/app"
        RecordingUI[Recording Interface]:::frontend
        click RecordingUI "https://github.com/nutlope/notesGPT/tree/main/app/record"
        DashboardUI[Dashboard Interface]:::frontend
        click DashboardUI "https://github.com/nutlope/notesGPT/tree/main/app/dashboard"
        Components[UI Components]:::frontend
        click Components "https://github.com/nutlope/notesGPT/tree/main/components/ui"
        AuthUI[Authentication UI]:::frontend
        click AuthUI "https://github.com/nutlope/notesGPT/blob/main/components/ui/UserNav.tsx"
        ClientProvider[Client Provider]:::frontend
        click ClientProvider "https://github.com/nutlope/notesGPT/blob/main/app/ConvexClientProvider.tsx"
    end

    subgraph Auth
        AuthService[Authentication Service]:::auth
        click AuthService "https://github.com/nutlope/notesGPT/blob/main/app/auth.ts"
        Clerk[Clerk Integration]:::auth
    end

    subgraph Backend
        ConvexBackend[Convex Backend]:::backend
        click ConvexBackend "https://github.com/nutlope/notesGPT/blob/main/convex/schema.ts"
        DataModels[Data Models]:::backend
        click DataModels "https://github.com/nutlope/notesGPT/blob/main/convex/_generated/dataModel.d.ts"
        FileStorage[File Storage]:::storage
    end

    subgraph AI_Services
        TogetherAI[Together.ai LLM]:::ai
        click TogetherAI "https://github.com/nutlope/notesGPT/blob/main/convex/together.ts"
        Whisper[Whisper Transcription]:::ai
        click Whisper "https://github.com/nutlope/notesGPT/blob/main/convex/whisper.ts"
        VectorStorage[Vector Storage]:::storage
    end

    subgraph Features
        ActionItems[Action Items]:::feature
        click ActionItems "https://github.com/nutlope/notesGPT/tree/main/app/dashboard/action-items"
        Search[Vector Search]:::feature
        Utils[Utility Functions]:::util
        click Utils "https://github.com/nutlope/notesGPT/blob/main/lib/utils.ts"
    end

    %% Relationships
    UI --> AuthUI
    UI --> RecordingUI
    UI --> DashboardUI
    UI --> Components
    UI --> ClientProvider

    AuthUI --> AuthService
    AuthService --> Clerk

    RecordingUI --> ConvexBackend
    DashboardUI --> ConvexBackend

    ConvexBackend --> FileStorage
    ConvexBackend --> DataModels
    ConvexBackend --> TogetherAI
    ConvexBackend --> Whisper
    ConvexBackend --> VectorStorage

    TogetherAI --> ActionItems
    VectorStorage --> Search

    ConvexBackend --> Utils

    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef auth fill:#2ecc71,stroke:#27ae60,color:white
    classDef backend fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef ai fill:#9b59b6,stroke:#8e44ad,color:white
    classDef storage fill:#e67e22,stroke:#d35400,color:white
    classDef feature fill:#f1c40f,stroke:#f39c12,color:black
    classDef util fill:#bdc3c7,stroke:#95a5a6,color:black

    %% Legend
    subgraph Legend
        Frontend[Frontend]:::frontend
        Auth[Authentication]:::auth
        Back[Backend]:::backend
        AI[AI Services]:::ai
        Store[Storage]:::storage
        Feat[Features]:::feature
        Utility[Utilities]:::util
    end
```
