# pranav-kunjir/prompt2motion architecture

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

- Interactive diagram: https://gitdiagram.com/pranav-kunjir/prompt2motion
- Repository: https://github.com/pranav-kunjir/prompt2motion

## Overview

##### Project type and purpose
- This is a full-stack, single-page React application (built with Vite and TypeScript) that collects user prompts, invokes AI (OpenAI) to generate Manim animation code, renders videos via a serverless backend (Convex functions), and delivers the resulting animations back to the user.

##### File structure
- Top-level “src/” folder: contains React components (`App.tsx`, pages, UI components, CSS, assets, dev-time type definitions, the entry point `main.tsx`).
- “convex/” folder: Convex-based backend functions, generated API and server stubs, schema, auth config. This is your serverless service layer.
- “src/functions/…”: client-side wrappers around backend calls (e.g., `GenerateManimCode.tsx`, `ChatWithUser.tsx`) that invoke Convex functions over HTTP.
- Config files: `vite.config.ts`, multiple tsconfigs, `.prettierrc`, `eslint.config.js`, `package.json` define the build and lint pipeline.
- “public/” and “src/assets/”: static assets such as demo videos and the `index.html` shell.

##### README
- Purpose: “Prompt2motion: An application that takes in user input and creates animation with help of AI in Manim.”

- Clear labels: name each component (e.g., “React SPA”, “Convex Function: GenerateManimCode”, “OpenAI API”, “Manim Render Engine”).
- Blue rectangles for frontend UI modules
- Orange hexagons for serverless functions
- Gray clouds for external services (OpenAI, Manim)
- Annotations: note file locations or module names in small text (e.g., “Auth UI: `src/auth/SignInGoogle.tsx`”).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Side
    subgraph "Client (Browser)"
        direction TB
        Main["Entry Point\nsrc/main.tsx"]:::frontend
        App["App Component\nsrc/App.tsx"]:::frontend
        Landing["Landing Page\nsrc/pages/Landing.tsx"]:::frontend
        Workspace["Animation Workspace\nsrc/pages/AnimationWorkSpace.tsx"]:::frontend
        Dashboard["User Dashboard\nsrc/pages/UserDashBoard.tsx"]:::frontend
        subgraph "Auth UI"
            direction TB
            GH["GitHub Sign-In\nsrc/auth/SignInGithub.tsx"]:::frontend
            GOOG["Google Sign-In\nsrc/auth/SignInGoogle.tsx"]:::frontend
            PW["Password Sign-In\nsrc/auth/SignInPassword.tsx"]:::frontend
            SO["Sign Out\nsrc/auth/SignOut.tsx"]:::frontend
        end
        subgraph "UI Components"
            direction TB
            ChatApp["ChatApp\nsrc/components/ChatApp.tsx"]:::frontend
            Chat["Chat\nsrc/components/Chat.tsx"]:::frontend
            InputField["InputField\nsrc/components/InputField.tsx"]:::frontend
            CodeEditor["CodeEditor\nsrc/components/CodeEditor.tsx"]:::frontend
            VideoPlayer["VideoPlayer\nsrc/components/VideoPlayer.tsx"]:::frontend
            RenderPlay["RenderAndPlayVideo\nsrc/components/RenderAndPlayVideo.tsx"]:::frontend
        end
        subgraph "Client-side Wrappers"
            direction TB
            CWU["ChatWithUser Wrapper\nsrc/functions/ChatWithUser.tsx"]:::frontend
            ID["IntentDetector Wrapper\nsrc/functions/IntentDetector.tsx"]:::frontend
            GMC["GenerateManimCode Wrapper\nsrc/functions/GenarateManimCode.tsx"]:::frontend
            RVW["RenderVideo Wrapper\nsrc/functions/RenderVideo.tsx"]:::frontend
            UMC["UpdateManimCode Wrapper\nsrc/functions/UpdateManimCode.tsx"]:::frontend
        end
        Assets["Static Videos\nsrc/assets/videos/..."]:::database
    end

    %% Backend Side
    subgraph "Serverless Backend (Convex)"
        direction TB
        HTTP["HTTP Config & API Stubs\nconvex/http.ts\nconvex/_generated/api.js/.d.ts"]:::serverless
        subgraph "Convex Functions"
            direction TB
            FChat["Function: ChatWithUser\nconvex/myFunctions.ts"]:::serverless
            FIntent["Function: IntentDetector\nconvex/myFunctions.ts"]:::serverless
            FGen["Function: GenerateManimCode\nconvex/myFunctions.ts"]:::serverless
            FRender["Function: RenderVideo\nconvex/myFunctions.ts"]:::serverless
            FUpdate["Function: UpdateManimCode\nconvex/myFunctions.ts"]:::serverless
        end
        Schema["Database Schema\nconvex/schema.ts"]:::database
        AuthConf["Auth Config\nconvex/auth.config.ts\nconvex/auth.ts"]:::serverless
    end

    %% External Services
    OpenAI["OpenAI API"]:::external
    Manim["Manim Render Engine"]:::external
    Blob["Blob Storage (Videos)"]:::database

    %% Client Flow
    Main --> App
    App --> Landing
    App --> Workspace
    App --> Dashboard
    App --> GH
    App --> GOOG
    App --> PW
    App --> SO

    Landing --> ChatApp
    Workspace --> CodeEditor
    Workspace --> InputField
    Workspace --> RenderPlay
    ChatApp --> Chat
    Chat --> CWU
    CWU --> HTTP
    ID --> HTTP
    GMC --> HTTP
    RVW --> HTTP
    UMC --> HTTP

    HTTP --> FChat
    HTTP --> FIntent
    HTTP --> FGen
    HTTP --> FRender
    HTTP --> FUpdate

    FChat --> OpenAI
    FIntent --> OpenAI
    FGen --> OpenAI
    FRender --> Manim
    FRender --> Blob
    FUpdate --> Blob

    FChat --> Schema
    FIntent --> Schema
    FGen --> Schema
    FRender --> Schema
    FUpdate --> Schema

    FChat --> HTTP
    FIntent --> HTTP
    FGen --> HTTP
    FRender --> HTTP
    FUpdate --> HTTP

    HTTP --> CWU
    HTTP --> ID
    HTTP --> GMC
    HTTP --> RVW
    HTTP --> UMC

    RVW --> VideoPlayer
    UMC --> RenderPlay
    Assets --> VideoPlayer
    Assets --> RenderPlay

    %% Click Events
    click Main "https://github.com/pranav-kunjir/prompt2motion/blob/main/src/main.tsx"
    click App "https://github.com/pranav-kunjir/prompt2motion/blob/main/src/App.tsx"
    click Landing "https://github.com/pranav-kunjir/prompt2motion/blob/main/src/pages/Landing.tsx"
    click Workspace "https://github.com/pranav-kunjir/prompt2motion/blob/main/src/pages/AnimationWorkSpace.tsx"
    click Dashboard "https://github.com/pranav-kunjir/prompt2motion/blob/main/src/pages/UserDashBoard.tsx"
    click GH "https://github.com/pranav-kunjir/prompt2motion/blob/main/src/auth/SignInGithub.tsx"
    click GOOG "https://github.com/pranav-kunjir/prompt2motion/blob/main/src/auth/SignInGoogle.tsx"
    click PW "https://github.com/pranav-kunjir/prompt2motion/blob/main/src/auth/SignInPassword.tsx"
    click SO "https://github.com/pranav-kunjir/prompt2motion/blob/main/src/auth/SignOut.tsx"
    click ChatApp "https://github.com/pranav-kunjir/prompt2motion/blob/main/src/components/ChatApp.tsx"
    click Chat "https://github.com/pranav-kunjir/prompt2motion/blob/main/src/components/Chat.tsx"
    click InputField "https://github.com/pranav-kunjir/prompt2motion/blob/main/src/components/InputField.tsx"
    click CodeEditor "https://github.com/pranav-kunjir/prompt2motion/blob/main/src/components/CodeEditor.tsx"
    click VideoPlayer "https://github.com/pranav-kunjir/prompt2motion/blob/main/src/components/VideoPlayer.tsx"
    click RenderPlay "https://github.com/pranav-kunjir/prompt2motion/blob/main/src/components/RenderAndPlayVideo.tsx"
    click CWU "https://github.com/pranav-kunjir/prompt2motion/blob/main/src/functions/ChatWithUser.tsx"
    click ID "https://github.com/pranav-kunjir/prompt2motion/blob/main/src/functions/IntentDetector.tsx"
    click GMC "https://github.com/pranav-kunjir/prompt2motion/blob/main/src/functions/GenarateManimCode.tsx"
    click RVW "https://github.com/pranav-kunjir/prompt2motion/blob/main/src/functions/RenderVideo.tsx"
    click UMC "https://github.com/pranav-kunjir/prompt2motion/blob/main/src/functions/UpdateManimCode.tsx"
    click HTTP "https://github.com/pranav-kunjir/prompt2motion/blob/main/convex/http.ts"
    click FChat "https://github.com/pranav-kunjir/prompt2motion/blob/main/convex/myFunctions.ts"
    click FIntent "https://github.com/pranav-kunjir/prompt2motion/blob/main/convex/myFunctions.ts"
    click FGen "https://github.com/pranav-kunjir/prompt2motion/blob/main/convex/myFunctions.ts"
    click FRender "https://github.com/pranav-kunjir/prompt2motion/blob/main/convex/myFunctions.ts"
    click FUpdate "https://github.com/pranav-kunjir/prompt2motion/blob/main/convex/myFunctions.ts"
    click Schema "https://github.com/pranav-kunjir/prompt2motion/blob/main/convex/schema.ts"
    click AuthConf "https://github.com/pranav-kunjir/prompt2motion/blob/main/convex/auth.config.ts"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#3399ff,color:#000;
    classDef serverless fill:#ffe5cc,stroke:#ff9933,color:#000;
    classDef database fill:#ccffcc,stroke:#33cc33,color:#000;
    classDef external fill:#e0e0e0,stroke:#999999,color:#000;
```
