# marcelo-earth/generative-manim architecture

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

- Interactive diagram: https://gitdiagram.com/marcelo-earth/generative-manim
- Repository: https://github.com/marcelo-earth/generative-manim

## Overview

##### Project Type and Purpose
- Project Type: A full-stack application that leverages language models to generate and render animations.
- Purpose: Converts text prompts into animated videos using Manim. It supports different LLM models and includes an API for processing as well as both command-line and graphical interfaces (via Streamlit).

##### File Structure
- Top-Level Modules/Directories:
- “api”: Contains the backend API with routes for chat generation, code generation, and video rendering. Includes an OpenAPI schema which strongly implies the API serves as the central service for processing requests.
- “animo”: A package with a client component and resources for videos. This module likely abstracts some animation-specific functionality and acts as an interfacing library with Manim.
- “streamlit”: Contains a legacy or complementary user interface built with the Streamlit framework, including its own Dockerfile/docker-compose for deployment.
- “datasets”: Provides code samples, test cases, and data in various formats for training/fine-tuning or demonstration purposes.
- “experiments”: Contains Jupyter notebooks and experimental scripts that likely help to validate models or pipeline behavior.
- Root files (like main.py, run.py, Dockerfile, etc.) that bootstrap the application and facilitate development/deployment.
- Key Observation: The system has several distinct layers (API backend, animation processing library, UI, and experimental code) that interact with one another.

##### README for Additional Insights
- The README clarifies that the core functionality (“Models”) is about converting text to code which is then rendered as a video. This indicates that the pipeline must integrate LLMs, code generation, and animation rendering.
- The README also lists different models, showing that multiple LLMs can be interchanged or used concurrently.
- The project uses a custom API (documented in the “api” folder with clear routes) and also offers a Streamlit-based UI for users.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Nodes
    User("User"):::usernode
    UI["Streamlit UI"]:::frontend
    API["API Gateway"]:::api
    subgraph "LLM Integration"
        GPT4["GM GPT-4o"]:::llm
        GPT35["GM GPT-3.5"]:::llm
        Claude["GM Claude"]:::llm
    end
    LLMOut["LLM Output"]:::llm
    Animation["Animation Renderer (animo)"]:::animation
    Datasets["Datasets Handling"]:::datasets
    Experiments["Experiments & Prototyping"]:::experiments
    Deployment["Deployment & Containerization"]:::deployment

    %% Relationships
    User -->|"input"| UI
    User -->|"API_call"| API
    UI -->|"submit"| API
    API -->|"prompt"| GPT4
    API -->|"prompt"| GPT35
    API -->|"prompt"| Claude
    GPT4 -->|"output"| LLMOut
    GPT35 -->|"output"| LLMOut
    Claude -->|"output"| LLMOut
    LLMOut -->|"code"| Animation
    Animation -->|"video"| API
    API -->|"deliver"| UI
    UI -->|"display"| User

    %% Supporting relationships
    Datasets -.->|"supports"| LLMOut
    Experiments -.->|"validates"| LLMOut
    Deployment -.->|"hosts"| UI
    Deployment -.->|"hosts"| API
    Deployment -.->|"hosts"| Animation

    %% Click Events for API Layer
    click API "https://github.com/marcelo-earth/generative-manim/tree/main/api/"
    click API "https://github.com/marcelo-earth/generative-manim/blob/main/api/routes/chat_generation.py"
    click API "https://github.com/marcelo-earth/generative-manim/blob/main/api/routes/code_generation.py"
    click API "https://github.com/marcelo-earth/generative-manim/blob/main/api/routes/video_rendering.py"
    click API "https://github.com/marcelo-earth/generative-manim/blob/main/api/public/openapi.yaml"

    %% Click Events for Frontend/UI
    click UI "https://github.com/marcelo-earth/generative-manim/blob/main/streamlit/src/main.py"
    click UI "https://github.com/marcelo-earth/generative-manim/tree/main/streamlit/src/pages"

    %% Click Events for Animation Processing
    click Animation "https://github.com/marcelo-earth/generative-manim/blob/main/animo/src/animo/client.py"
    click Animation "https://github.com/marcelo-earth/generative-manim/blob/main/animo/src/animo/resources/videos.py"

    %% Click Events for Datasets
    click Datasets "https://github.com/marcelo-earth/generative-manim/tree/main/datasets/code/"

    %% Click Events for Experiments
    click Experiments "https://github.com/marcelo-earth/generative-manim/tree/main/experiments/"

    %% Click Events for Deployment/Containerization
    click Deployment "https://github.com/marcelo-earth/generative-manim/blob/main/.devcontainer"
    click Deployment "https://github.com/marcelo-earth/generative-manim/tree/main/Dockerfile"
    click Deployment "https://github.com/marcelo-earth/generative-manim/blob/main/streamlit/docker-compose.yml"

    %% Styles
    classDef usernode fill:#CCCCFF,stroke:#000,stroke-width:2px;
    classDef frontend fill:#66ff66,stroke:#000,stroke-width:2px;
    classDef api fill:#ffb347,stroke:#000,stroke-width:2px;
    classDef llm fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef animation fill:#FDC830,stroke:#000,stroke-width:2px;
    classDef datasets fill:#FFCCCC,stroke:#000,stroke-width:2px;
    classDef experiments fill:#FFDDCC,stroke:#000,stroke-width:2px;
    classDef deployment fill:#D3D3D3,stroke:#000,stroke-width:2px;
```
