# ajinkya1718/museum-chatbot architecture

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

- Interactive diagram: https://gitdiagram.com/ajinkya1718/museum-chatbot
- Repository: https://github.com/ajinkya1718/museum-chatbot

## Overview

##### Project type and purpose
- This is a Python-based, AI-driven chatbot web application for museum ticket booking and visitor information.
- It combines a lightweight HTTP server, a static front-end, an LLM/chat logic layer, analytics, and a payment interface.

##### File structure
Top-level files and directories:
- server.py – HTTP server entrypoint (likely Flask/FastAPI or built-in HTTP).
- llm.py – encapsulates the large-language-model interactions.
- chatbot.py – conversation management and routing user queries.
- analytics.py – collects usage data, logs interactions or metrics.
- main.py – orchestration script that ties server, chatbot, LLM, and analytics modules.
- index.html + static/… – front-end UI (HTML/CSS/JS) served to the browser.
- payment/index.html – payment gateway front-end template.
- requirements.txt – Python dependencies (e.g., openai, Flask).

##### README for additional insights
- The README confirms:
- Access via http://localhost:8000
- Launch point: python llm.py (though server.py or main.py may actually start the app in practice)
- Key features: ticket booking (with an embedded payment gateway), FAQs, accessibility info, real-time updates, multilingual support, and data security.

##### Final advice
- How data flows between browser, server, AI, and payment gateway.
- Security/encryption layer for ticket bookings.
- Keep it detailed but organized in horizontal layers (UI → API → business logic → external).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Frontend (Browser)" 
        style Frontend fill:#cfe2f3,stroke:#000
        IndexHTML["index.html"]:::frontend
        StylesCSS["static/css/styles.css"]:::frontend
        ScriptsJS["static/js/scripts.js"]:::frontend
        PaymentHTML["payment/index.html"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Services"
        style Backend fill:#d9ead3,stroke:#000
        Server["HTTP Server (server.py)"]:::backend
        Main["Orchestrator (main.py)"]:::backend
        Chatbot["Chatbot Logic (chatbot.py)"]:::backend
        LLM["LLM Integration (llm.py)"]:::backend
        Analytics["Analytics Module (analytics.py)"]:::backend
    end

    %% External Services
    subgraph "External Services"
        style External fill:#fce5cd,stroke:#000
        PaymentGateway["Payment Gateway API"]:::external
        AnalyticsStore[(Analytics Store)]:::db
        BookingDB[(Booking Database)]:::db
    end

    %% Data Flows
    IndexHTML -->|GET /| Server
    StylesCSS -->|GET /static/css| Server
    ScriptsJS -->|GET /static/js| Server
    PaymentHTML -->|GET /payment| Server

    Server -->|route requests| Main
    Main -->|invoke dialogue| Chatbot
    Main -->|log events| Analytics

    Chatbot -->|query LLM| LLM
    LLM -->|AI response| Chatbot

    Server -->|POST /chat| Chatbot
    Chatbot -->|response| Server
    Server -->|return JSON| ScriptsJS

    Server -->|POST /payment| PaymentGateway
    PaymentGateway -->|confirmation| Server
    Server -->|display confirmation| PaymentHTML

    Analytics -->|store logs| AnalyticsStore

    Server -->|save booking| BookingDB
    Analytics -->|store metrics| BookingDB

    %% Click Events
    click IndexHTML "https://github.com/ajinkya1718/museum-chatbot/blob/main/index.html"
    click StylesCSS "https://github.com/ajinkya1718/museum-chatbot/blob/main/static/css/styles.css"
    click ScriptsJS "https://github.com/ajinkya1718/museum-chatbot/blob/main/static/js/scripts.js"
    click PaymentHTML "https://github.com/ajinkya1718/museum-chatbot/blob/main/payment/index.html"
    click Server "https://github.com/ajinkya1718/museum-chatbot/blob/main/server.py"
    click Main "https://github.com/ajinkya1718/museum-chatbot/blob/main/main.py"
    click Chatbot "https://github.com/ajinkya1718/museum-chatbot/blob/main/chatbot.py"
    click LLM "https://github.com/ajinkya1718/museum-chatbot/blob/main/llm.py"
    click Analytics "https://github.com/ajinkya1718/museum-chatbot/blob/main/analytics.py"

    %% Styles
    classDef frontend fill:#cfe2f3,stroke:#036;color:#000
    classDef backend fill:#d9ead3,stroke:#264;color:#000
    classDef external fill:#fce5cd,stroke:#a45;color:#000
    classDef db fill:#ffe599,stroke:#b58;color:#000
```
