# hitotori365/2025-zenn-hackathon architecture

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

- Interactive diagram: https://gitdiagram.com/hitotori365/2025-zenn-hackathon
- Repository: https://github.com/hitotori365/2025-zenn-hackathon

## Overview

##### Main Components
- Frontend Application:
– Contains a Flutter-based mobile application for both Android and iOS (as seen under frontend/android and frontend/ios), as well as a web version (frontend/web).
– Uses the provider pattern for state management (providers directory in frontend/lib) to manage messages, speech state, scrolling, etc.
– Contains UI components (views) that include the chat list, completion screen, speech and text field views.
- Backend Service:
– Built with Python (backend/app/main.py), likely serving as an API service for the frontend to communicate with.
– Uses a Dockerfile and accompanying configuration (e.g., .env.example, deploy.sh) to containerize and deploy the service.
- Infrastructure Management & Deployment:
– Both frontend and backend include Terraform configuration files (main.tf, variables.tf, outputs.tf, terraform.tfvars) which suggests infrastructure as code is used for setting up cloud resources or deployment environments.
- Sample Module:
– A separate “sample” project with Python scripts (like transcribe_streaming_infinite.py and test_speech_to_text_mic.py) that likely demonstrates core functionalities – particularly around speech-to-text processing, which is a prominent theme in parts of the frontend (e.g., simple_speech_to_text in the Android code).

##### Relationships and Interactions
- The Backend processes requests, which might include actions such as speech recognition or other business logic. It then returns responses to the frontend.
- Infrastructure components provisioned via Terraform automate the deployment of both the frontend and backend environments using Docker containers.
- The Sample modules can be seen as standalone scripts or as demonstration components that might interact with similar services or simulate parts of the real application’s functionality.

##### Architectural Patterns & Design Principles
- Separation of concerns: The project is divided into clearly segregated components – frontend (UI & state management), backend (service logic), and infrastructure (deployment/ops scripts).
- Containerization: Dockerfiles in both the frontend and backend indicate the use of containerization for reproducible builds and deployments.
- Infrastructure as Code: Terraform scripts help in provisioning and versioning the deployment environment, which is central for both production and development setups.
- Mobile/Flutter design: The use of provider patterns for state management in Flutter ensures that the UI remains reactive to changes in speech state, chat updates, etc.

##### Elements
– Mobile Clients: Android App, iOS App, and Web Client (highlight Flutter based)
– API Gateway/Backend Service (Python)
– Infrastructure Component (Terraform-managed cloud/deployment environment)
– Additional Sample/Demo Scripts (as a supportive component for speech-to-text functionality)
– Data and request-response flows between the mobile clients and the backend.
– Management or orchestration flows between Terraform-configured infrastructure and the containerized services.
- Text labels or annotations next to each component to indicate key technologies:
– Frontend: Flutter, Dart, Provider package
– Backend: Python, Docker, and potentially relevant libraries from requirements.txt
– Deployment: Docker, Terraform configurations, and associated scripts to manage deployment.

- Separation between the mobile/web client (fronted by Flutter) and the backend service.
- That the infrastructure (using Terraform) ties together the containerized builds of both frontend and backend.
- Annotations to highlight the speech-to-text functionality as a core feature since it appears both in naming (simple_speech_to_text) and in sample modules that test this functionality.
- Notes on environment variables and containerization details, as seen by the .env.example files and Dockerfiles.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Application
    subgraph "Frontend Application (Flutter)"
        direction TB
        FE1["Android App (Flutter)"]:::frontend
        FE2["iOS App (Flutter)"]:::frontend
        FE3["Web App (Flutter)"]:::frontend
        FE4["State Management (Provider)"]:::frontend
        FE5["UI Components (Views)"]:::frontend
    end

    %% Backend Service
    subgraph "Backend Service"
        direction TB
        BE1["Python API Service"]:::backend
        BE2["Docker & Env Configurations"]:::backend
    end

    %% Infrastructure & Deployment
    subgraph "Infrastructure & Deployment"
        direction TB
        INF1["Terraform Configs (Backend)"]:::infrastructure
        INF2["Terraform & Deployment (Frontend)"]:::infrastructure
        INF3["Docker Containerization"]:::infrastructure
    end

    %% Sample Module for Speech-to-Text
    subgraph "Sample Module (Speech-to-Text)"
        direction TB
        SM1["Speech-to-Text Demos"]:::sample
    end

    %% Interconnections between Frontend and Backend
    FE1 -->|"API_Call"| BE1
    FE2 -->|"API_Call"| BE1
    FE3 -->|"API_Call"| BE1
    BE1 -->|"Response"| FE1
    BE1 -->|"Response"| FE2
    BE1 -->|"Response"| FE3

    %% Backend internal connection
    BE1 -->|"Uses"| BE2

    %% Infrastructure deployment flows
    INF1 -->|"Deploys"| BE1
    INF1 -->|"Deploys"| BE2
    INF2 -->|"Deploys"| FE1
    INF2 -->|"Deploys"| FE2
    INF2 -->|"Deploys"| FE3
    INF2 -->|"Deploys"| FE4
    INF2 -->|"Deploys"| FE5
    INF3 -->|"Containerizes"| BE2
    INF3 -->|"Containerizes"| FE1
    INF3 -->|"Containerizes"| FE2
    INF3 -->|"Containerizes"| FE3

    %% Sample module interactions
    SM1 -->|"Demonstrates"| FE4
    SM1 -->|"Tests_API"| BE1

    %% Click Events for Frontend Components
    click FE1 "https://github.com/hitotori365/2025-zenn-hackathon/tree/main/frontend/android"
    click FE2 "https://github.com/hitotori365/2025-zenn-hackathon/tree/main/frontend/ios"
    click FE3 "https://github.com/hitotori365/2025-zenn-hackathon/tree/main/frontend/web"
    click FE4 "https://github.com/hitotori365/2025-zenn-hackathon/tree/main/frontend/lib/providers"
    click FE5 "https://github.com/hitotori365/2025-zenn-hackathon/tree/main/frontend/lib/views"

    %% Click Events for Backend Components
    click BE1 "https://github.com/hitotori365/2025-zenn-hackathon/blob/main/backend/app/main.py"
    click BE2 "https://github.com/hitotori365/2025-zenn-hackathon/tree/main/backend/Dockerfile"
    click BE2 "https://github.com/hitotori365/2025-zenn-hackathon/blob/main/backend/.env.example"
    click BE2 "https://github.com/hitotori365/2025-zenn-hackathon/blob/main/backend/deploy.sh"

    %% Click Events for Infrastructure Components
    click INF1 "https://github.com/hitotori365/2025-zenn-hackathon/blob/main/backend/main.tf"
    click INF1 "https://github.com/hitotori365/2025-zenn-hackathon/blob/main/backend/variables.tf"
    click INF2 "https://github.com/hitotori365/2025-zenn-hackathon/blob/main/frontend/main.tf"
    click INF2 "https://github.com/hitotori365/2025-zenn-hackathon/blob/main/frontend/variables.tf"
    click INF2 "https://github.com/hitotori365/2025-zenn-hackathon/blob/main/frontend/outputs.tf"
    click INF2 "https://github.com/hitotori365/2025-zenn-hackathon/blob/main/frontend/terraform.tfvars"
    click INF3 "https://github.com/hitotori365/2025-zenn-hackathon/tree/main/frontend/Dockerfile"

    %% Click Event for Sample Module
    click SM1 "https://github.com/hitotori365/2025-zenn-hackathon/tree/main/sample/src/sample"

    %% Styles for each component type
    classDef frontend fill:#A6CEE3,stroke:#1F78B4,stroke-width:2px;
    classDef backend fill:#B2DF8A,stroke:#33A02C,stroke-width:2px;
    classDef infrastructure fill:#FDBF6F,stroke:#FF7F00,stroke-width:2px;
    classDef sample fill:#CAB2D6,stroke:#6A3D9A,stroke-width:2px;
```
