# lothnic/zographika architecture

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

- Interactive diagram: https://gitdiagram.com/lothnic/zographika
- Repository: https://github.com/lothnic/zographika

## Overview

##### Project type and purpose
- This is a full-stack web application (“Zographika”) whose goal is to let end users enter text prompts in a React/Vite front-end, forward those prompts to a Flask back-end, use Google’s Gemini API to generate Manim scripts, render animations with Manim, and return the resulting media to the front end for display or download.

##### File structure
- Root files:
- app.py – entry point for the Flask service
- Dockerfile – builds the back-end container
- render.yaml – Render.com deployment config
- vercel.json – Vercel config for the front end
- requirements.txt – Python dependencies (Flask, Manim, Gemini client, etc.)
- Front-end (frontend/):
- Vite-powered React app (App.jsx, components/, assets/, etc.)
- .env.production holds the back-end URL
- package.json/npm scripts, public/index.html
- Generated artifacts:
- generated_scripts/ – auto-created Manim .py scripts
- templates/ – Jinja2 HTML templates for Flask (e.g., index.html)
- Miscellaneous:
- my_animation.py – example/utility script
- deploy-frontend.sh – helper to build & push front end

##### README for additional insights
- Workflow: user → React UI → Flask API → Gemini API → Manim CLI → video/gif → React UI
- No persistent database; scripts and outputs live on the file system or in memory.
- Deployment: front end on Vercel; back end on Render.com (Docker).

##### Detail without over-complication
- Logical component (even if it’s just a small script directory).
- Model data flow from user input → API → rendering → output.
- Deployment boundaries (cloud providers, container boundaries).

## Diagram (Mermaid)

```mermaid
flowchart TD
    classDef user fill:#D0E6FF,stroke:#0366D6,color:#0366D6;
    classDef frontend fill:#E3FCEF,stroke:#28A745,color:#28A745;
    classDef backend fill:#FFF5E5,stroke:#DA9100,color:#DA9100;
    classDef external fill:#FEE2E2,stroke:#D73A49,color:#D73A49;
    classDef store fill:#E5E5E5,stroke:#6A737D,color:#6A737D;

    User["User Browser"]:::user
    subgraph "Front-End (Vercel)"
        FE_DIR["frontend/"]:::frontend
        FE_APP["React App"]:::frontend
        FE_ENTRY["App.jsx"]:::frontend
        FE_VITE["vite.config.js"]:::frontend
        FE_PKG["package.json"]:::frontend
        FE_ENV[".env.production"]:::frontend
        FE_VERCEL["vercel.json"]:::external
        FE_DEPLOY["deploy-frontend.sh"]:::frontend
        FE_DIR --> FE_APP
        FE_APP --> FE_ENTRY
        FE_DIR --> FE_VITE
        FE_DIR --> FE_PKG
        FE_DIR --> FE_ENV
        FE_DIR --> FE_VERCEL
        FE_DIR --> FE_DEPLOY
    end

    subgraph "Back-End (Render.com)"
        BE_API["app.py (Flask API)"]:::backend
        TPL["templates/index.html"]:::backend
        GS["generated_scripts/"]:::store
        MA["my_animation.py"]:::backend
        MANIM["Manim CLI"]:::backend
        DOCKER["Dockerfile"]:::external
        RENDER_CONF["render.yaml"]:::external
        BE_API --> TPL
    end

    GEMINI["Gemini API"]:::external

    User -->|"1. load UI"| FE_APP
    FE_APP -->|"2. POST prompt"| BE_API
    BE_API -->|"3. call Gemini"| GEMINI
    GEMINI -->|"3. return script"| BE_API
    BE_API -->|"4. write script"| GS
    BE_API -->|"5. invoke renderer"| MANIM
    MANIM -->|"6. output media"| GS
    BE_API -->|"7. send media"| FE_APP

    click FE_DIR "https://github.com/lothnic/zographika/tree/main/frontend/"
    click FE_ENTRY "https://github.com/lothnic/zographika/blob/main/frontend/src/App.jsx"
    click FE_VITE "https://github.com/lothnic/zographika/blob/main/frontend/vite.config.js"
    click FE_PKG "https://github.com/lothnic/zographika/blob/main/frontend/package.json"
    click FE_ENV "https://github.com/lothnic/zographika/blob/main/frontend/.env.production"
    click FE_VERCEL "https://github.com/lothnic/zographika/blob/main/frontend/vercel.json"
    click FE_DEPLOY "https://github.com/lothnic/zographika/blob/main/deploy-frontend.sh"
    click BE_API "https://github.com/lothnic/zographika/blob/main/app.py"
    click TPL "https://github.com/lothnic/zographika/blob/main/templates/index.html"
    click GS "https://github.com/lothnic/zographika/tree/main/generated_scripts/"
    click MA "https://github.com/lothnic/zographika/blob/main/my_animation.py"
    click DOCKER "https://github.com/lothnic/zographika/tree/main/Dockerfile"
    click RENDER_CONF "https://github.com/lothnic/zographika/blob/main/render.yaml"

    class User user
    class FE_DIR,FE_APP,FE_ENTRY,FE_VITE,FE_PKG,FE_ENV,FE_DEPLOY frontend
    class BE_API,MA,MANIM backend
    class GEMINI,FE_VERCEL,DOCKER,RENDER_CONF external
    class GS store
```
