# heyysiri/namamigange architecture

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

- Interactive diagram: https://gitdiagram.com/heyysiri/namamigange
- Repository: https://github.com/heyysiri/namamigange

## Overview

##### Project type and purpose
- This is a full-stack AI/ML chatbot system:
- Backend: Rasa open-source conversational AI framework (NLU + Core)
- Custom actions server (Python, GPT-4-Free, OpenWeather calls)
- Frontend: React single-page application (my-react-app) providing animated UI/quiz

##### File structure
- Top-level Rasa files:
- config.yml, credentials.yml, endpoints.yml – Rasa configuration for pipelines, channels, action endpoints
- domain.yml – intents, entities, slots, responses
- data/ – NLU training data (nlu.yml), rules (rules.yml), stories (stories.yml)
- story_graph.dot – visual map of stories
- requirements.txt – Python dependencies
- rasa_feedback2.db – SQLite tracker store (if used)
- my-react-app/ – React UI
- public/ – static index.html, robots.txt
- src/ – components: Popup.js, Quiz1.js, blinking.js, talking.js, etc.
- package.json – React dependencies and scripts
- rasa-env/ – Python virtual environment containing the action server
- actions/actions.py – custom actions implementing GPT-4-Free and OpenWeather queries
- actions/gpt4free – cloned GPT-4-Free integration
- tests/ – any unit tests for actions

##### README for additional insights
- Overview: Chatbot “Cha-cha Chaudhary” educating on Namami Gange, quizzes, GPT-4-Free integration
- Setup: describes Rasa training/run, React npm start, action server run
- External services: GPT-4-Free, OpenWeather API

1. User (Browser)
2. React Frontend (my-react-app)
3. Rasa Server (rasa run)
4. Action Server (rasa run actions in rasa-env/actions)
5. SQLite Tracker Store (rasa_feedback2.db)
6. External Services:
– GPT-4-Free API
– OpenWeather API
1. User → React UI (HTTP/WebSocket)
2. React UI → Rasa REST endpoint (endpoints.yml, CORS enabled)
3. Rasa NLU & Core → reads domain.yml, data/*.yml
4. Rasa Core → calls Action Server (via endpoints.yml) for custom logic
5. Action Server → GPT-4-Free (local clone or remote)
6. Action Server → OpenWeather API (requires API key in actions.py)
7. Action Server → returns slot updates/messages → Rasa Core
8. Rasa Core → persists conversation tracker to SQLite → sends reply → React UI → User
c. Architectural patterns & principles:
– Microservice-like separation: Rasa Core vs. action server
– Clear API boundary: React ↔ Rasa REST, Rasa ↔ actions gRPC/HTTP
– Configuration-as-code: YAML files for pipeline, domain, credentials
– Virtual environment isolation for Python dependencies
d. Key technologies/frameworks:
– Rasa (NLU, Core)
– Python (v3.8) custom actions, GPT-4-Free integration
– React (hooks, components, CSS for animations)
– Node.js & npm for front end
– SQLite (or alternative) for tracker store

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer (React SPA)"
        direction TB
        RF_pkg["package.json"]:::frontend
        RF_indexhtml["public/index.html"]:::frontend
        RF_popup["Popup.js"]:::frontend
        RF_quiz1["Quiz1.js"]:::frontend
        RF_blink["blinking.js"]:::frontend
    end

    %% Orchestration Layer
    subgraph "Orchestration Layer (Rasa NLU & Core)"
        direction TB
        R_config["config.yml"]:::orchestration
        R_credentials["credentials.yml"]:::orchestration
        R_endpoints["endpoints.yml"]:::orchestration
        R_domain["domain.yml"]:::orchestration
        R_nlu["data/nlu.yml"]:::orchestration
        R_rules["data/rules.yml"]:::orchestration
        R_stories["data/stories.yml"]:::orchestration
        R_visual["story_graph.dot"]:::orchestration
        R_reqs["requirements.txt"]:::orchestration
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer (Custom Actions)"
        direction TB
        A_server["actions.py"]:::business
        A_gpt4["gpt4free/"]:::external
        A_tests["tests/test_stories.yml"]:::business
    end

    %% Data & External Services
    subgraph "Data & External Services"
        direction TB
        DB["rasa_feedback2.db"]:::datastore
        EXT_gptAPI["GPT-4-Free API"]:::external
        EXT_weather["OpenWeather API"]:::external
    end

    %% User
    User["User (Browser)"]:::external

    %% Connections
    User -->|"interacts via HTTP/WS:3000"| RF_pkg
    RF_pkg -->|"REST API HTTP:5005"| R_config
    R_config -->|"triggers pipeline"| R_nlu
    R_config -->|"uses channel config"| R_credentials
    R_endpoints -->|"action endpoint"| A_server
    R_domain -->|"defines intents/entities"| R_nlu
    R_nlu -->|"stories & rules"| R_stories
    R_reqs -->|"env deps"| A_server
    R_reqs -->|"env deps"| R_config
    R_config -.->|tracker persist| DB
    R_config -->|"calls actions"| A_server
    A_server -->|"calls"| EXT_gptAPI
    A_server -->|"calls"| EXT_weather
    A_server -->|"returns slot updates"| R_config
    R_config -->|"responds"| RF_pkg
    R_config -.->|persist conversation| DB

    %% Click Events
    click RF_pkg "https://github.com/heyysiri/namamigange/blob/main/my-react-app/package.json"
    click RF_indexhtml "https://github.com/heyysiri/namamigange/blob/main/my-react-app/public/index.html"
    click RF_popup "https://github.com/heyysiri/namamigange/blob/main/my-react-app/src/Popup.js"
    click RF_quiz1 "https://github.com/heyysiri/namamigange/blob/main/my-react-app/src/Quiz1.js"
    click RF_blink "https://github.com/heyysiri/namamigange/blob/main/my-react-app/src/blinking.js"
    click R_config "https://github.com/heyysiri/namamigange/blob/main/config.yml"
    click R_credentials "https://github.com/heyysiri/namamigange/blob/main/credentials.yml"
    click R_endpoints "https://github.com/heyysiri/namamigange/blob/main/endpoints.yml"
    click R_domain "https://github.com/heyysiri/namamigange/blob/main/domain.yml"
    click R_nlu "https://github.com/heyysiri/namamigange/blob/main/data/nlu.yml"
    click R_rules "https://github.com/heyysiri/namamigange/blob/main/data/rules.yml"
    click R_stories "https://github.com/heyysiri/namamigange/blob/main/data/stories.yml"
    click R_visual "https://github.com/heyysiri/namamigange/blob/main/story_graph.dot"
    click R_reqs "https://github.com/heyysiri/namamigange/blob/main/requirements.txt"
    click A_server "https://github.com/heyysiri/namamigange/blob/main/rasa-env/actions/actions.py"
    click A_gpt4 "https://github.com/heyysiri/namamigange/tree/main/rasa-env/actions/gpt4free/"
    click A_tests "https://github.com/heyysiri/namamigange/blob/main/rasa-env/tests/test_stories.yml"
    click DB "https://github.com/heyysiri/namamigange/blob/main/rasa_feedback2.db"

    %% Styles
    classDef frontend fill:#D6EAF8,stroke:#3498DB,color:#1B4F72
    classDef orchestration fill:#D5F5E3,stroke:#27AE60,color:#145A32
    classDef business fill:#FDEBD0,stroke:#E67E22,color:#873600
    classDef external fill:#E5E7E9,stroke:#7F8C8D,color:#1C2833
    classDef datastore fill:#FADBD8,stroke:#C0392B,color:#641E16
```
