# nextgenailabs/genaimindmapflowbuilder architecture

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

- Interactive diagram: https://gitdiagram.com/nextgenailabs/genaimindmapflowbuilder
- Repository: https://github.com/nextgenailabs/genaimindmapflowbuilder

## Overview

##### Project Type & Purpose
- This is a full‐stack, AI-powered application designed to parse and analyze various data sources (documents, CSVs, media, web pages, etc.) and generate interactive, automated mind maps.
- The README details key features such as multi-source data integration, automatic/manual mind map generation, cross-source questioning, and PDF report export. The project leverages advanced LLMs (OpenAI GPT-4o, Google Gemini Pro) and integrates with various vector storage engines.

##### Analyzing the File Structure
- Two Main Directories:
- Frontend: Contains a ReactJS-based UI with directories for assets, configuration, hooks, modals, and components. Focus areas include interactive elements for uploading data, visualizing mind maps, and managing flows.
- Backend: Contains a FastAPI Python app with subdirectories for various data stores (CSVVectorStore, SQLVectorStore, chroma) and a large “vanna” module that houses integrations with multiple providers (OpenAI, Anthropic, Google, HuggingFace, etc.). Additional folders include models, temporary SQL utilities, and even pre-built databases.
- The backend further incorporates configuration files (requirements.txt, pyproject.toml) and databases (SQLite databases, local file system-based vector store files).

##### Key Components

a. User Interface / Frontend:
- ReactJS-based frontend application with components such as Landing Page, Global Components (e.g., AddDataSource, AskMultiple, Graph, Modal), Hooks, and Modals.
- User interactions covering data upload, choosing agents, selecting flow modes, and visualizing outputs (mind maps, graphs, tables, PDF exports).

b. API Layer / Backend:
- FastAPI server which acts as the entry point for frontend API calls.
- Separate endpoints for data ingestion, querying, mind map generation, and report export.

c. AI Models & Integration Modules:
- Integration with AI services (OpenAI GPT-4o, Google Gemini Pro) for NLP tasks, summarization, and mind map generation.
- “Vanna” directory modules that interface with various vector storage providers (Chroma, FAISS, Pinecone, Qdrant, etc.), ensuring flexibility in how vector data is managed.
- Integration modules for additional services such as Anthropic, Azuresearch, Bedrock, etc.

d. Data Storage and Persistence:
- Databases: SQLite instances (e.g., sqlite_data.db, CSV databases) as well as MongoDB (as per the README’s tech stack).
- Vector Stores: Multiple vector store formats including ChromaDB, SQLVectorStore, CSVVectorStore available in the backend directory.
- Local file system storage for persistent files and possibly external storage (AWS S3) per the README instructions.

e. Auxiliary Components:
- Configuration/Environment: Use of .env for secrets and configuration impacting both API integrations and database connectivity.
- Build/Deployment Configs: Frontend and backend package files (package.json, pyproject.toml) which drive dependency and build configuration.

##### Architectural Patterns and Data Flow
- Separation between the client (frontend) and server (backend) using a service/API boundary.
- How user actions (e.g., file uploads, triggering AI queries) on the frontend send requests to FastAPI backend endpoints.
- Backend’s internal flow for data processing:
- Ingestion → data preprocessing → AI summarization / mind map generation via LLM API calls → updating vector store and databases → generating modals or PDF outputs.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "User Interface / Frontend"
        FE["React Frontend"]:::frontend
    end

    %% Backend API Layer
    subgraph "API Layer / Backend"
        BE["FastAPI Server"]:::backend
    end

    %% AI Models & Integration Modules
    subgraph "AI Models & Integration Modules"
        Vanna["Vanna Integrations"]:::ai
        OA["OpenAI Integration"]:::ai
        Gemini["Google Gemini Integration"]:::ai
    end

    %% Data Storage and Persistence
    subgraph "Data Storage and Persistence"
        subgraph "Vector Stores"
            CSVVS["CSVVectorStore"]:::datastore
            SQLVS["SQLVectorStore"]:::datastore
            Chroma["Chroma Vector Store"]:::datastore
        end
        subgraph "Databases"
            CSVDB["CSV Database"]:::database
            SQLite["SQLite Database"]:::database
        end
    end

    %% Auxiliary Configuration Components
    subgraph "Auxiliary Components"
        subgraph "Backend Configuration"
            Req["requirements.txt"]:::config
            Pyproj["pyproject.toml"]:::config
        end
        subgraph "Frontend Configuration"
            Pkg["package.json"]:::config
            ESLint["eslint.config.js"]:::config
            Prettier[".prettierrc"]:::config
        end
    end

    %% Connections
    FE -->|"calls"| BE
    BE -->|"processes"| Vanna
    Vanna -->|"calls"| OA
    Vanna -->|"calls"| Gemini
    BE -->|"storesData"| CSVVS
    BE -->|"storesData"| SQLVS
    BE -->|"storesData"| Chroma
    BE -->|"updates"| CSVDB
    BE -->|"updates"| SQLite
    FE -->|"readsConfig"| Pkg
    BE -->|"readsConfig"| Req

    %% Click Events
    click FE "https://github.com/nextgenailabs/genaimindmapflowbuilder/tree/main/frontend/src"
    click BE "https://github.com/nextgenailabs/genaimindmapflowbuilder/blob/main/backend/app.py"
    click Vanna "https://github.com/nextgenailabs/genaimindmapflowbuilder/tree/main/backend/vanna"
    click OA "https://github.com/nextgenailabs/genaimindmapflowbuilder/blob/main/backend/vanna/openai/openai_chat.py"
    click Gemini "https://github.com/nextgenailabs/genaimindmapflowbuilder/blob/main/backend/vanna/google/gemini_chat.py"
    click CSVVS "https://github.com/nextgenailabs/genaimindmapflowbuilder/tree/main/backend/CSVVectorStore"
    click SQLVS "https://github.com/nextgenailabs/genaimindmapflowbuilder/tree/main/backend/SQLVectorStore"
    click Chroma "https://github.com/nextgenailabs/genaimindmapflowbuilder/tree/main/backend/chroma"
    click CSVDB "https://github.com/nextgenailabs/genaimindmapflowbuilder/blob/main/backend/csv_data.db"
    click SQLite "https://github.com/nextgenailabs/genaimindmapflowbuilder/blob/main/backend/sqlite_data.db"
    click Req "https://github.com/nextgenailabs/genaimindmapflowbuilder/blob/main/backend/requirements.txt"
    click Pyproj "https://github.com/nextgenailabs/genaimindmapflowbuilder/blob/main/backend/pyproject.toml"
    click Pkg "https://github.com/nextgenailabs/genaimindmapflowbuilder/blob/main/frontend/package.json"
    click ESLint "https://github.com/nextgenailabs/genaimindmapflowbuilder/blob/main/frontend/eslint.config.js"
    click Prettier "https://github.com/nextgenailabs/genaimindmapflowbuilder/blob/main/frontend/.prettierrc"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef ai fill:#DDA0DD,stroke:#000,stroke-width:2px;
    classDef datastore fill:#FFFACD,stroke:#000,stroke-width:2px;
    classDef database fill:#FFEFD5,stroke:#000,stroke-width:2px;
    classDef config fill:#D3D3D3,stroke:#000,stroke-width:2px;
```
