# bjesus/teatime architecture

> Architecture diagram of the GitHub repository bjesus/teatime, 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/bjesus/teatime
- Repository: https://github.com/bjesus/teatime

## Overview

##### Main Components

a) Frontend Layer (Nuxt.js Application):
- Search Interface (AdvancedSearch.vue)
- Book Viewer (BookView.vue)
- Settings Management (Settings.vue)
- Instance Selection (Instances.vue)
- Local Storage (IndexDB)

b) Data Sources Layer:
1. GitHub Pages Container:
- Database Repositories (teatime-database)
- Configuration Files (config.json)
- SQLite Databases
2. IPFS Network Container:
- Book Files Storage

c) Integration Layer:
- sql.js-httpvfs connector
- IPFS Gateway

##### Technical Details

- Database Schema
- Supported File Formats
- Key Technologies:
- Nuxt.js
- IPFS
- SQLite
- sql.js-httpvfs
- IndexDB

##### Architectural Patterns to Emphasize

- Decentralized Architecture
- Static Site Generation
- Client-Side Processing
- Local-First Data Management

**[User Layer]**
- ↓
**[Frontend Instances Layer]**
- ↓
**[Integration Layer]**
- ↓
**[Distributed Storage Layer]**

##### How the system maintains resilience through distribution

- The frontend can be hosted anywhere
- Databases are independent GitHub repositories
- Content is served through IPFS
- No central server is required
- All processing happens client-side

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph User
        U[User Interface]
    end

    subgraph "Frontend Instances"
        FE[Nuxt.js Application]
        
        subgraph "Core Components"
            AS["Search Interface"]:::component
            BV["Book Viewer"]:::component
            SM["Settings Management"]:::component
            IS["Instance Selection"]:::component
            BL["Book Listing"]:::component
            BC["Book Card"]:::component
            HD["Application Header"]:::component
            EH["Error Handler"]:::component
        end

        subgraph "Configuration"
            AC["App Config"]:::config
            NC["Nuxt Config"]:::config
            RC["Root Component"]:::component
        end

        subgraph "Local Storage"
            IDB["IndexDB Storage"]:::storage
        end
    end

    subgraph "Integration Layer"
        SQLH["sql.js-httpvfs"]:::connector
        IPFSG["IPFS Gateway"]:::connector
    end

    subgraph "Distributed Storage"
        subgraph "GitHub Pages"
            DB["Database Repositories"]:::storage
            CF["Configuration Files"]:::storage
            SQL["SQLite Databases"]:::storage
            CI["CI/CD Pipeline"]:::pipeline
        end

        subgraph "IPFS Network"
            IPFS["Book Files Storage"]:::storage
        end
    end

    %% Relationships
    U --> FE
    FE --> AS
    FE --> BV
    FE --> SM
    FE --> IS
    FE --> BL
    FE --> BC
    FE --> HD
    FE --> EH
    FE --> IDB
    FE --> SQLH
    FE --> IPFSG
    SQLH --> DB
    IPFSG --> IPFS
    DB --> SQL
    
    %% Click Events
    click AS "https://github.com/bjesus/teatime/blob/main/components/AdvancedSearch.vue"
    click BV "https://github.com/bjesus/teatime/blob/main/components/BookView.vue"
    click SM "https://github.com/bjesus/teatime/blob/main/components/Settings.vue"
    click IS "https://github.com/bjesus/teatime/blob/main/components/Instances.vue"
    click IDB "https://github.com/bjesus/teatime/blob/main/indexdb.ts"
    click BL "https://github.com/bjesus/teatime/blob/main/components/BooksList.vue"
    click BC "https://github.com/bjesus/teatime/blob/main/components/BookCard.vue"
    click HD "https://github.com/bjesus/teatime/blob/main/components/Header.vue"
    click EH "https://github.com/bjesus/teatime/blob/main/components/Error.vue"
    click AC "https://github.com/bjesus/teatime/blob/main/app.config.ts"
    click NC "https://github.com/bjesus/teatime/blob/main/nuxt.config.ts"
    click RC "https://github.com/bjesus/teatime/blob/main/app.vue"
    click CI "https://github.com/bjesus/teatime/blob/main/.github/workflows/nuxtjs.yml"

    %% Styles
    classDef component fill:#a8d5e5,stroke:#457b9d
    classDef config fill:#ffd6a5,stroke:#cc7722
    classDef storage fill:#caffbf,stroke:#2d6a4f
    classDef connector fill:#bdb2ff,stroke:#5a189a
    classDef pipeline fill:#ffc6ff,stroke:#9d4edd

    %% Legend
    subgraph Legend
        L1["Component"]:::component
        L2["Configuration"]:::config
        L3["Storage"]:::storage
        L4["Connector"]:::connector
        L5["Pipeline"]:::pipeline
    end
```
