# yorunor/benches-docker-front architecture

> Architecture diagram of the GitHub repository yorunor/benches-docker-front, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yorunor/benches-docker-front
- Repository: https://github.com/yorunor/benches-docker-front

## Overview

##### Main system components
- Frontend (Web Client):
- Located in the “web” directory.
- Built with Vue.js, uses Vite for build tooling, and manages state, views, and layouts.
- Communicates with the backend via the GraphQL API.
- Configured with Firebase for authentication.

- Backend API:
- Found in the “api” directory.
- Written in Python (evidenced by files like manage.py, asgi.py, and the presence of migrations and models).
- Uses GraphQL setup (with directories for schemas, resolvers for queries and mutations, and custom types).
- Exposes endpoints for both the operation interface (e.g., /signin and task management) and for administrative tasks (/admin).
- Includes management commands (located in api/libs/management) for operations like seeding and migrations.

- Database:
- Appears in the “db” directory (docker initialization scripts, e.g., init-user-psql.sh).
- Likely PostgreSQL (suggested by environment settings in .env.local).

- External Services:
- Firebase used for authentication (configurations present in web/.env.development and parameters in the API’s environment file).
- External LLM servers (e.g., TGI, vllm, OpenAI, and others) are required as per the README.
- Langfuse for logging/monitoring (running on its container and connected via defined environment variables).

- Docker Compose and Containerization:
- Docker Compose manages different containers for the API, Frontend, DB, and Langfuse.
- Each container has its own Dockerfile (located under api/containers/development and web/containers/development).

##### Relationships and interactions
- The API also depends on external LLM services to process requests (such as generation tasks), so illustrate outbound connections to external “LLM Service” components.
- Authentication is handled via Firebase on the Frontend (and possibly on the backend for user management), so note this connection.
- Langfuse is integrated into the API environment (using Langfuse keys), and a container is exposed on port 3000; include this as a separate component feeding logs or metrics.

##### Architectural Patterns and Principles
- Separation of Concerns: The project is split between frontend and backend; these are clearly modularized in separate directories and run in different containers.
- GraphQL API: The backend adopts a GraphQL controller pattern with resolvers for queries and mutations; representing this layered API architecture is crucial.
- Containerization: Docker Compose orchestrates multi-container deployment. Emphasize the containerized setup.

##### Relevant Technologies and Frameworks
- Frontend: Vue.js, Vite, and supporting libraries including Firebase integration.
- Backend: Python with a GraphQL framework (possibly Django or FastAPI with Graphene or similar, given the project structure).
- Database: PostgreSQL.
- Infrastructure: Docker and Docker Compose.
- Others: Firebase for authentication, third-party LLM services, and Langfuse for logging.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        FE["Web Client (Vue.js)"]:::frontend
        subgraph "Firebase Auth"
            FirebaseConfig["Config (.env)"]:::external
            FirebaseService["Service (firebase.ts)"]:::external
        end
    end

    %% Backend Layer
    subgraph "Backend Layer"
        BE["API Server (Python/GraphQL)"]:::backend
        Resolvers["GraphQL Schemas & Resolvers"]:::internal
        Management["Management Commands"]:::internal
    end

    %% Data Persistence
    subgraph "Data Persistence"
        DB["PostgreSQL DB"]:::database
    end

    %% External Services
    subgraph "External Services"
        LLM["LLM Services"]:::external
        Langfuse["Langfuse Logging/Analytics"]:::external
    end

    %% Containerization and Orchestration
    subgraph "Containerization"
        Docker_API["API Dockerfile (Development)"]:::container
        Docker_FE["Frontend Dockerfile (Development)"]:::container
        DockerCompose["Docker Compose Orchestration"]:::container
    end

    %% Connections
    FE -->|"GraphQL" | BE
    BE -->|"Uses" | Resolvers
    BE -->|"Runs" | Management
    BE -->|"Queries" | DB
    BE -->|"Calls" | LLM
    BE -->|"LogsTo" | Langfuse
    FE -->|"Auth" | FirebaseConfig
    FE -->|"Auth" | FirebaseService
    DockerCompose --> Docker_API
    DockerCompose --> Docker_FE

    %% Click Events
    click FE "https://github.com/yorunor/benches-docker-front/tree/main/web/"
    click BE "https://github.com/yorunor/benches-docker-front/tree/main/api/"
    click Resolvers "https://github.com/yorunor/benches-docker-front/tree/main/api/app/graphql/"
    click Management "https://github.com/yorunor/benches-docker-front/tree/main/api/libs/management/commands/"
    click DB "https://github.com/yorunor/benches-docker-front/blob/main/db/init/init-user-psql.sh"
    click FirebaseConfig "https://github.com/yorunor/benches-docker-front/blob/main/web/.env.development.sample"
    click FirebaseService "https://github.com/yorunor/benches-docker-front/blob/main/web/src/services/firebase.ts"
    click LLM "https://github.com/yorunor/benches-docker-front/tree/main/web/src/data/presets/"
    click Langfuse "https://github.com/yorunor/benches-docker-front/blob/main/api/libs/services/prompt_logger/langfuse.py"
    click Docker_API "https://github.com/yorunor/benches-docker-front/tree/main/api/containers/development/Dockerfile"
    click Docker_FE "https://github.com/yorunor/benches-docker-front/tree/main/web/containers/development/Dockerfile"
    click DockerCompose "https://github.com/yorunor/benches-docker-front/blob/main/docker-compose.yml"

    %% Styles
    classDef frontend fill:#bbf,stroke:#333,stroke-width:2px;
    classDef backend fill:#f9c,stroke:#333,stroke-width:2px;
    classDef external fill:#cfc,stroke:#333,stroke-width:2px;
    classDef database fill:#fcf,stroke:#333,stroke-width:2px;
    classDef container fill:#cff,stroke:#333,stroke-width:2px;
    classDef internal fill:#ffd,stroke:#333,stroke-width:2px;
```
