# yarivtch/text-summarizer architecture

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

- Interactive diagram: https://gitdiagram.com/yarivtch/text-summarizer
- Repository: https://github.com/yarivtch/text-summarizer

## Overview

##### Main Components

a) Frontend Layer:
- Web Browser Client
- HTML/CSS/JavaScript stack
- User Interface Components (Text input, Summary type selector, Submit button)

b) Backend Layer:
- FastAPI Server
- Python Runtime
- AI Integration (Ollama with Aya model)

##### Component Relationships

- Client-Server communication via HTTP/REST
- Backend integration with Ollama AI service
- Data flow from user input to summary output

**[Client Tier]**

- ▼
**[Application Tier]**

- ▼
**[AI Service Tier]**

##### Additional Elements

Specific details:
- Port numbers (if any, like 8080 mentioned in README)
- API endpoints for text summarization
- Data format indicators (JSON payloads)
- System requirements callout (Python 3.8+)

##### Notes for Implementation

- The simplicity of the three-tier architecture
- The clear separation between frontend and backend
- The integration point with the AI service
- The stateless nature of the application
- The modern web technologies used (FastAPI, JavaScript)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Define styles
    classDef frontend fill:#e1f5fe,stroke:#01579b
    classDef backend fill:#e8f5e9,stroke:#1b5e20
    classDef ai fill:#f3e5f5,stroke:#4a148c
    classDef api fill:#fff3e0,stroke:#e65100

    %% Client Tier
    subgraph Browser["Web Browser Client"]
        UI["User Interface"]:::frontend
        HTML["index.html"]:::frontend
        CSS["styles.css"]:::frontend
        MainJS["main.js"]:::frontend
        CandJS["candidates.js"]:::frontend
        
        UI --> HTML
        HTML --> CSS
        HTML --> MainJS
        HTML --> CandJS
    end

    %% Application Tier
    subgraph Server["FastAPI Server"]
        API["REST API Endpoints"]:::backend
        PyRuntime["Python Runtime (3.8+)"]:::backend
        ServerPy["server.py"]:::backend
        Dependencies["System Dependencies"]:::backend
        
        API --> ServerPy
        ServerPy --> PyRuntime
        PyRuntime --> Dependencies
    end

    %% AI Service Tier
    subgraph AIService["AI Service Layer"]
        Ollama["Ollama Service"]:::ai
        AyaModel["Aya Model"]:::ai
        
        Ollama --> AyaModel
    end

    %% Connections between tiers
    Browser --"HTTP Requests"--> Server
    Server --"AI Requests"--> AIService
    AIService --"AI Response"--> Server
    Server --"HTTP Response"--> Browser

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        BackendComp["Backend Component"]:::backend
        AIComp["AI Component"]:::ai
        APIComp["API Component"]:::api
    end

    %% Click events for component mapping
    click HTML "https://github.com/yarivtch/text-summarizer/blob/main/frontend/index.html"
    click CSS "https://github.com/yarivtch/text-summarizer/blob/main/frontend/css/styles.css"
    click MainJS "https://github.com/yarivtch/text-summarizer/blob/main/frontend/js/main.js"
    click CandJS "https://github.com/yarivtch/text-summarizer/blob/main/frontend/js/candidates.js"
    click ServerPy "https://github.com/yarivtch/text-summarizer/blob/main/backend/server.py"
    click Dependencies "https://github.com/yarivtch/text-summarizer/blob/main/requirements.txt"
```
