# murphybread/fetchable-custom-quotes architecture

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

- Interactive diagram: https://gitdiagram.com/murphybread/fetchable-custom-quotes
- Repository: https://github.com/murphybread/fetchable-custom-quotes

## Overview

##### Main Components

a. Client Layer
- Web Browsers
- Obsidian MD (specifically mentioned as a use case)
- Any HTTP client

b. Serverless Layer (Vercel Functions)
- API Routes (/api/quote.js)
- Query Parameter Handler
- Content Search Logic

c. Data Storage
- Static JSON File (data.json)

##### Flow Representation

- Blue for direct ID-based queries
- Green for content-based search queries
- Gray for full data retrieval

##### Specific Implementation Details to Highlight

a. Request Handling:
- Client -> Vercel Edge Network -> Serverless Function -> Data Access

b. Query Types (show as branches):
- Base path (returns full data.json)
- ID-based query (?id=UUID)
- Content search query (text-based search)

##### Technical Specifications

- Quote {
- content: string
- author: string
- type: enum['original', 'quote', 'interpretation']
- id: UUID
- }

##### Important Design Elements

- Use a rectangle with rounded corners for the Vercel Functions

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Layer
    subgraph Clients
        Browser["Web Browsers"]:::client
        Obsidian["Obsidian MD"]:::client
        HTTPClient["HTTP Clients"]:::client
    end

    %% Vercel Layer
    subgraph "Vercel Edge Network"
        Edge["Edge Network"]:::vercel
    end

    %% Serverless Layer
    subgraph "Serverless Functions"
        APIRoute["API Route Handler"]:::serverless
        QueryHandler["Query Parameter Handler"]:::serverless
        SearchLogic["Content Search Logic"]:::serverless
    end

    %% Data Layer
    subgraph "Data Storage"
        DataJSON["data.json\n(Static Storage)"]:::storage
    end

    %% Schema Definition
    subgraph "Data Schema"
        Schema[" Quote {
            content: string
            author: string
            type: enum
            id: UUID
        }"]:::schema
    end

    %% Connections
    Browser --> |HTTP Request| Edge
    Obsidian --> |HTTP Request| Edge
    HTTPClient --> |HTTP Request| Edge
    Edge --> APIRoute
    APIRoute --> QueryHandler
    QueryHandler --> SearchLogic
    SearchLogic --> DataJSON
    DataJSON -.-> Schema

    %% Click Events
    click APIRoute "https://github.com/murphybread/fetchable-custom-quotes/blob/main/api/quote.js"
    click DataJSON "https://github.com/murphybread/fetchable-custom-quotes/blob/main/data.json"
    click Edge "https://github.com/murphybread/fetchable-custom-quotes/blob/main/vercel.json"
    click QueryHandler "https://github.com/murphybread/fetchable-custom-quotes/blob/main/localTest.js"

    %% Styles
    classDef client fill:#a8dadc,stroke:#457b9d,stroke-width:2px
    classDef vercel fill:#1d3557,stroke:#457b9d,color:#fff
    classDef serverless fill:#e63946,stroke:#457b9d,color:#fff
    classDef storage fill:#f1faee,stroke:#457b9d,stroke-width:2px
    classDef schema fill:#ffd700,stroke:#457b9d,stroke-width:1px

    %% Legend
    subgraph Legend
        L1[Client Components]:::client
        L2[Vercel Infrastructure]:::vercel
        L3[Serverless Functions]:::serverless
        L4[Data Storage]:::storage
        L5[Schema Definition]:::schema
    end
```
