# arcturus-labs/llm-text-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/arcturus-labs/llm-text-assistant
- Repository: https://github.com/arcturus-labs/llm-text-assistant

## Overview

##### Main Components

A. Frontend Layer (React):
- Components Module (showing key components like ArtifactPanel, MessageContent)
- Assets
- Main Application Entry (App.jsx)

B. Backend Layer (Flask):
- API Routes Module
- Static Routes Module
- Subscription Routes Module

C. Infrastructure Layer:
- Docker Container (encompassing both frontend and backend)
- Fly.io Deployment Platform

##### Component Relationships

- Frontend-Backend communication through API endpoints
- Docker container encapsulation
- Deployment flow to Fly.io
- Request/response flow between components

##### Detailed Component Breakdown

Frontend Structure:
**React Application**
- Components
- ArtifactPanel
- ArtifactTab
- MessageContent
- SubscriptionCheck
- Assets
- Main Application (App.jsx)

Backend Structure:
**Flask Application**
- API Routes
- Conversation
- Tools
- General Routes
- Static Routes
- Subscription Routes

##### Additional Elements

Supporting components:
- Testing Framework connections (Jest for frontend, Pytest for backend)
- Build/Deploy pipeline (GitHub Actions)
- Development tools (Vite, Babel)

##### Infrastructure Layer (Docker + Fly.io)

Use these symbols:
- Rectangles: Components and modules

##### Important Notes

- Separation of concerns between frontend and backend
- API communication paths
- Containerization boundary
- CI/CD pipeline flow
- Development tooling connections

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Backend Layer"
        BE[Flask Application]
        
        subgraph "Core Logic"
            CL["Core Logic Module"]
            subgraph "Services"
                AS["Authentication Service"]
                CS["Conversation Service"]
                TS["Tools Service"]
            end
            
            subgraph "Data Models"
                UM["User Model"]
                CM["Conversation Model"]
                TM["Tool Model"]
            end
        end
        
        subgraph "API Routes"
            subgraph "Conversation API"
                CR["POST /conversation/new"]
                CH["GET /conversation/history"]
                CD["DELETE /conversation/:id"]
            end
            
            subgraph "Tools API"
                TL["GET /tools/list"]
                TE["POST /tools/execute"]
                TS2["GET /tools/status"]
            end
            
            subgraph "Auth API"
                AR["POST /auth/register"]
                AL["POST /auth/login"]
                AV["GET /auth/verify"]
            end
        end
        
        subgraph "Middleware"
            AM["Auth Middleware"]
            EM["Error Handler"]
            VM["Validation"]
        end
        
        BE --> CL
        CL --> AS
        CL --> CS
        CL --> TS
        
        AS --> UM
        CS --> CM
        TS --> TM
        
        CR --> AM --> CS
        CH --> AM --> CS
        CD --> AM --> CS
        
        TL --> AM --> TS
        TE --> AM --> TS
        TS2 --> AM --> TS
        
        AR --> AS
        AL --> AS
        AV --> AM --> AS
        
        BE --> EM
        BE --> VM
    end
    
    %% Click events preserved from original
    click CR "https://github.com/arcturus-labs/llm-text-assistant/blob/main/backend/app/routes/api/conversation.py"
    click TS "https://github.com/arcturus-labs/llm-text-assistant/blob/main/backend/app/routes/api/tools.py"
    
    classDef service fill:#2a9d8f,color:#fff
    classDef model fill:#264653,color:#fff
    classDef route fill:#e9c46a,color:#000
    classDef middleware fill:#f4a261,color:#000
    classDef core fill:#2a9d8f,color:#fff
    
    class BE,CL core
    class AS,CS,TS service
    class UM,CM,TM model
    class CR,CH,CD,TL,TE,TS2,AR,AL,AV route
    class AM,EM,VM middleware
```
