# kefirchk/animatica-frontend architecture

> Architecture diagram of the GitHub repository kefirchk/animatica-frontend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kefirchk/animatica-frontend
- Repository: https://github.com/kefirchk/animatica-frontend

## Overview

##### Project type and purpose
- This is a single‐service frontend application built on Streamlit (Python) that provides a UI for Animatica’s video‐generation API. It automates page rendering (home, auth, pricing, about), static asset hosting, user authentication, subscription/payment flows, and calls out to an external backend API for actual video generation.

##### File structure
- Top level
- app/                 ← Streamlit app root
– Dockerfile         ← container definition
– requirements.txt   ← Python deps
– src/               ← application source
- app/src
- main.py             ← Streamlit entry point
- configs/            ← environment‐driven endpoint and feature flags
- renders/            ← functions that build Streamlit page layouts
- services/           ← business‐logic layer for auth, payment, animations
- templates/          ← Jinja or HTML snippets used in renders
- views/              ← high‐level page controllers tying renders + services
- assets/             ← static CSS/images used by pages
- Other files
- README.md           ← deployment steps, purpose
- Docker integration
- .gitignore, pyproject.toml

##### README for additional insights
- Describes local and Docker deployment
- Points to an external API (API_URL) for actual work
- No backend code here—this is the UI only

##### Detailed checklist
– Frontend container boundary
– Entry point (main.py)
– Config module reading .env/API_URL
– Service modules (animation, auth, payment)
– External API endpoints
– Renderers + templates feeding Streamlit UI
– Static assets folder
– Docker build & run relationship

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Actors
    User["User"]:::external
    Browser["Browser"]:::external

    %% Infrastructure
    subgraph "Docker Container / Virtual Env" 
        direction TB
        Streamlit["Streamlit Server\n(app/src/main.py)"]:::infra
        %% Modules
        subgraph "Config Loader" 
            direction TB
            APIConfig["api.py"]:::internal
            AuthConfig["auth.py"]:::internal
            HomeConfig["home.py"]:::internal
            PricingConfig["pricing.py"]:::internal
        end
        subgraph "View Controllers"
            direction TB
            AboutView["about.py"]:::internal
            AuthView["auth.py"]:::internal
            HomeView["home.py"]:::internal
            PricingView["pricing.py"]:::internal
        end
        subgraph "Service Layer"
            direction TB
            AnimationSvc["animation.py"]:::internal
            AuthSvc["auth.py"]:::internal
            CookieSvc["cookie.py"]:::internal
            PaymentSvc["payment.py"]:::internal
            ResourceSvc["resource.py"]:::internal
        end
        subgraph "Renderer Layer"
            direction TB
            AuthRender["auth.py"]:::internal
            HomeRender["home.py"]:::internal
            PricingRender["pricing.py"]:::internal
            UtilsRender["utils.py"]:::internal
        end
        subgraph "Templates"
            direction TB
            AboutTpl["about.html"]:::internal
            AuthTpl["header.html\nlogin_column.html\nmain_container.html\nregister_column.html"]:::internal
            HomeTpl["driving_video.html\ngeneration_header.html\nsubscription_required.html"]:::internal
            PricingTpl["checkout_button.html\nheader.html\nplan_card.html\nselection_message.html"]:::internal
            SidebarTpl["credit_card.html"]:::internal
        end
        subgraph "Static Assets"
            direction TB
            Images["images/"]:::internal
            Styles["styles/"]:::internal
        end
        Dockerfile["Dockerfile"]:::infra
        Requirements["requirements.txt"]:::infra
        StreamlitConfig[".streamlit/config.toml"]:::infra
    end

    %% External systems
    ExternalAPI["External Backend API"]:::external
    PaymentGateway["Payment Processor"]:::external
    OAuthProvider["OAuth Provider"]:::external

    %% Flow
    User -->|"interacts via"| Browser
    Browser -->|"HTTP"| Streamlit
    Streamlit -->|"loads configs"| APIConfig
    Streamlit --> AuthConfig
    Streamlit --> HomeConfig
    Streamlit --> PricingConfig
    Streamlit -->|"routes to controllers"| AboutView
    Streamlit --> AuthView
    Streamlit --> HomeView
    Streamlit --> PricingView

    AboutView -->|"invoke renders"| AuthRender
    AuthView --> AuthRender
    HomeView --> HomeRender
    PricingView --> PricingRender

    AboutView --> AnimationSvc
    AuthView --> AuthSvc
    AuthView --> CookieSvc
    AuthView --> ResourceSvc
    PricingView --> PaymentSvc
    HomeView --> AnimationSvc

    AnimationSvc -->|"REST/JSON"| ExternalAPI
    AuthSvc -->|"REST/JSON"| ExternalAPI
    PaymentSvc -->|"REST/JSON"| ExternalAPI
    AuthSvc --> OAuthProvider
    PaymentSvc --> PaymentGateway

    ExternalAPI --> AnimationSvc
    OAuthProvider --> AuthSvc
    PaymentGateway --> PaymentSvc

    AuthRender --> Templates
    HomeRender --> Templates
    PricingRender --> Templates
    UtilsRender --> Templates

    AuthRender --> Styles
    HomeRender --> Styles
    PricingRender --> Styles
    UtilsRender --> Styles

    Templates --> Assets
    Styles --> Assets
    Images --> Assets

    Streamlit --> Dockerfile
    Streamlit --> Requirements
    Streamlit --> StreamlitConfig

    Streamlit -->|"serves UI"| Browser

    %% Click Events
    click Streamlit "https://github.com/kefirchk/animatica-frontend/blob/main/app/src/main.py"
    click APIConfig "https://github.com/kefirchk/animatica-frontend/blob/main/app/src/configs/api.py"
    click AuthConfig "https://github.com/kefirchk/animatica-frontend/blob/main/app/src/configs/auth.py"
    click HomeConfig "https://github.com/kefirchk/animatica-frontend/blob/main/app/src/configs/home.py"
    click PricingConfig "https://github.com/kefirchk/animatica-frontend/blob/main/app/src/configs/pricing.py"
    click AboutView "https://github.com/kefirchk/animatica-frontend/blob/main/app/src/views/about.py"
    click AuthView "https://github.com/kefirchk/animatica-frontend/blob/main/app/src/views/auth.py"
    click HomeView "https://github.com/kefirchk/animatica-frontend/blob/main/app/src/views/home.py"
    click PricingView "https://github.com/kefirchk/animatica-frontend/blob/main/app/src/views/pricing.py"
    click AuthRender "https://github.com/kefirchk/animatica-frontend/blob/main/app/src/renders/auth.py"
    click HomeRender "https://github.com/kefirchk/animatica-frontend/blob/main/app/src/renders/home.py"
    click PricingRender "https://github.com/kefirchk/animatica-frontend/blob/main/app/src/renders/pricing.py"
    click UtilsRender "https://github.com/kefirchk/animatica-frontend/blob/main/app/src/renders/utils.py"
    click AboutTpl "https://github.com/kefirchk/animatica-frontend/blob/main/app/src/templates/about/about.html"
    click AuthTpl "https://github.com/kefirchk/animatica-frontend/tree/main/app/src/templates/auth/"
    click HomeTpl "https://github.com/kefirchk/animatica-frontend/tree/main/app/src/templates/home/"
    click PricingTpl "https://github.com/kefirchk/animatica-frontend/tree/main/app/src/templates/pricing/"
    click SidebarTpl "https://github.com/kefirchk/animatica-frontend/blob/main/app/src/templates/sidebar/credit_card.html"
    click AnimationSvc "https://github.com/kefirchk/animatica-frontend/blob/main/app/src/services/animation.py"
    click AuthSvc "https://github.com/kefirchk/animatica-frontend/blob/main/app/src/services/auth.py"
    click CookieSvc "https://github.com/kefirchk/animatica-frontend/blob/main/app/src/services/cookie.py"
    click PaymentSvc "https://github.com/kefirchk/animatica-frontend/blob/main/app/src/services/payment.py"
    click ResourceSvc "https://github.com/kefirchk/animatica-frontend/blob/main/app/src/services/resource.py"
    click Images "https://github.com/kefirchk/animatica-frontend/tree/main/app/src/assets/images/"
    click Styles "https://github.com/kefirchk/animatica-frontend/tree/main/app/src/assets/styles/"
    click Dockerfile "https://github.com/kefirchk/animatica-frontend/tree/main/app/Dockerfile"
    click Requirements "https://github.com/kefirchk/animatica-frontend/blob/main/app/requirements.txt"
    click StreamlitConfig "https://github.com/kefirchk/animatica-frontend/blob/main/app/.streamlit/config.toml"

    %% Styles
    classDef internal fill:#b3cde0,stroke:#03396c,color:#03396c
    classDef external fill:#ccebc5,stroke:#006d2c,color:#006d2c
    classDef infra fill:#fdb462,stroke:#e6550d,color:#e6550d
```
