# adityabandaru18/metabot architecture

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

- Interactive diagram: https://gitdiagram.com/adityabandaru18/metabot
- Repository: https://github.com/adityabandaru18/metabot

## Overview

##### Project Type and Purpose
- MetaBot is an intelligent chatbot platform that enables SMEs to create customized chatbots for enhancing customer service. It automates chatbot creation by processing Excel file inputs and using AI technologies.
- The purpose is to allow business owners (like the shoe shop owner in the example) to upload product data and details so that a tailored chatbot can respond to customer queries.

##### Analyzing the File Structure
- Two primary sections exist:
- The “client” directory holds the frontend code. It uses modern tooling with React, TailwindCSS, Vite, and state management (Redux). Its component hierarchy is subdivided into dedicated folders such as Userlogin, Home, Main, and Firebase indicating separation of concerns (e.g., login functionality, homepage display, primary navigation, and integration with Firebase services).
- The “server” directory holds the backend application built with Django. Inside the “chatbot_api” folder, it follows Django’s standard project structure, including the “base” app with its models, views, serializers, and migrations. There are also CSV files that hint at the data sources being used to train or feed the chatbots.
- The presence of configuration files, migrations, and dedicated API endpoints (via serializers.py, views.py, and urls.py) points to a RESTful backend architecture.

##### Architectural Insights Derived from the README
- The README explains both the frontend (React) and backend (Django) technology stacks.
- It mentions integration with external AI technologies like Google AI Studio and Gemini API, which may interact with the Django backend for model creation and inference.
- The installation instructions require separate environments for the client and server, clarifying the two-tier (or multi-layer) architecture.

##### Components to be Represented
- Frontend (Client):
- Components: User Interface, Navigation, Home, Login/Signup, and other specialized components.
- Technologies: React, TailwindCSS, Redux, Vite.
- Interaction: Communicates with the backend API for operations such as file uploads and bot customization.
- Backend (Server):
- Main Backend Application: Django-based REST API built under “chatbot_api.”
- Sub-component “base”: Handles API endpoints, models, migrations, and data serialization.
- Database: SQLite (with migration files indicating schema evolution).
- Data Files: CSVs and other text files that serve as data sources for the chatbots.
- External Services:
- AI Model Services: Interfaces with Google AI Studio and Gemini API to support model creation and inference.
- Data Flow:
- The frontend gathers input data (e.g., Excel files) from end-users (SMEs) and sends requests to the backend API.
- The backend processes these inputs, possibly utilizing CSV data and invoking AI services to generate chatbot responses.
- Responses or updates are sent back to the frontend to render the chat interface for customers.

##### Architectural Patterns and Design Principles
- Full-stack separation: Distinct layers for the frontend (client-side single-page application) and backend (Django RESTful API).
- MVC-like pattern in Django where models, views, and serializers separate concerns.
- Clear separation of concerns on the frontend through modular components.

## Diagram (Mermaid)

```mermaid
flowchart TD
    USER["User (SME)"]:::external

    subgraph "Frontend (React UI Layer)"
        F1["React Frontend"]:::frontend
        F2["Login (Userlogin)"]:::frontend
        F3["Home"]:::frontend
        F4["Main Dashboard/Navigation"]:::frontend
        F5["Firebase Integration"]:::frontend
        F6["Redux State Management"]:::frontend
    end

    subgraph "Backend (Django REST API)"
        B1["Django API"]:::backend
        B2["Django Base App"]:::backend
        B3["SQLite Database"]:::database
        subgraph "Data Files"
            D1["amazon_laptop_prices_v01.csv"]:::data
            D2["GroceryDataset.csv"]:::data
            D3["Shoe prices.csv"]:::data
        end
    end

    subgraph "External AI Services"
        E1["Google AI Studio"]:::external
        E2["Gemini API"]:::external
    end

    %% Relationships for Frontend
    USER -->|"initiates"| F1
    F1 -->|"composes"| F2
    F1 -->|"composes"| F3
    F1 -->|"composes"| F4
    F1 -->|"composes"| F5
    F1 -->|"composes"| F6
    F1 -->|"sendsData"| B1

    %% Relationships for Backend
    B1 -->|"processes"| B2
    D1 -->|"feedsData"| B1
    D2 -->|"feedsData"| B1
    D3 -->|"feedsData"| B1
    B1 -->|"reads"| B3
    B1 -->|"invokes"| E1
    B1 -->|"invokes"| E2

    %% Click Events
    click F1 "https://github.com/adityabandaru18/metabot/tree/main/client/src/components"
    click F2 "https://github.com/adityabandaru18/metabot/tree/main/client/src/components/Userlogin"
    click F3 "https://github.com/adityabandaru18/metabot/tree/main/client/src/components/Home"
    click F4 "https://github.com/adityabandaru18/metabot/tree/main/client/src/components/Main"
    click F5 "https://github.com/adityabandaru18/metabot/tree/main/client/src/components/Firebase"
    click F6 "https://github.com/adityabandaru18/metabot/tree/main/client/src/components/redux"
    click B1 "https://github.com/adityabandaru18/metabot/tree/main/server/chatbot_api"
    click B2 "https://github.com/adityabandaru18/metabot/tree/main/server/chatbot_api/base"
    click B3 "https://github.com/adityabandaru18/metabot/blob/main/server/chatbot_api/db.sqlite3"
    click D1 "https://github.com/adityabandaru18/metabot/blob/main/server/amazon_laptop_prices_v01.csv"
    click D2 "https://github.com/adityabandaru18/metabot/blob/main/server/chatbot_api/GroceryDataset.csv"
    click D3 "https://github.com/adityabandaru18/metabot/blob/main/server/chatbot_api/Shoe prices.csv"

    %% Class Definitions
    classDef frontend fill:#DDEEFF,stroke:#333,stroke-width:2px;
    classDef backend fill:#FFEEDD,stroke:#333,stroke-width:2px;
    classDef database fill:#CCFFCC,stroke:#333,stroke-width:2px;
    classDef data fill:#FFFFCC,stroke:#333,stroke-width:2px;
    classDef external fill:#FFCCCC,stroke:#333,stroke-width:2px;
```
