# neel5252/neelchatbot architecture

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

- Interactive diagram: https://gitdiagram.com/neel5252/neelchatbot
- Repository: https://github.com/neel5252/neelchatbot

## Overview

##### Project type and purpose
- This is a full-stack Django web application (“NEEL-CHAT-BOT”) whose primary use cases are taking food orders and booking hotel rooms via a chatbot.
- It integrates with Dialogflow for natural-language understanding and uses Django (with SQLite) to persist and manage orders, users, etc.

##### File structure
- Top level:
- manage.py – Django’s command-line utility
- db.sqlite3 – development database
- ngrok.exe – local tunneling utility for exposing your local server when Dialogflow calls your webhook
- foodchatbox/ – the Django project folder (ASGI/WSGI, settings, URL routing)
- chatbox/ – the Django “app” containing models, views, templates, migrations, admin, and URL definitions
- “chatbox/templates/index.html” is the single front-end page (chat UI).
- Migrations under chatbox/migrations record schema changes for the chat/order models.
- Settings in foodchatbox/settings.py configure database, installed apps, static files, etc.

##### README for additional insights
- Confirms Django handles persistence, order tracking, and removal.
- Dialogflow is the external NLP engine for training and interpreting user messages.
- No other microservices – the system is monolithic on the server side, plus one external dependency (Dialogflow).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    UI["Browser UI\n(index.html)"]:::frontend

    %% Development Tooling
    Ngrok["Ngrok Tunnel"]:::dev

    %% Backend Layer
    subgraph "Backend (Django)"
        ASGI["ASGI Entry Point"]:::backend
        WSGI["WSGI Entry Point"]:::backend
        Settings["Settings & Config"]:::backend
        ProjectURLs["Project URL Router"]:::backend
        ChatboxURLs["Chatbox App URL Router"]:::backend

        subgraph "Chatbox App"
            Apps["App Config"]:::backend
            Models["Models"]:::backend
            Views["Views"]:::backend
            Admin["Admin Interface"]:::backend
        end
    end

    %% Data Layer
    DB["SQLite DB"]:::database

    %% External Service
    Dialogflow["Dialogflow API"]:::external

    %% Request Flow
    UI -->|"HTTP POST /chat"| Ngrok
    Ngrok --> ASGI
    ASGI --> Settings
    ASGI --> ProjectURLs
    ProjectURLs --> ChatboxURLs
    ChatboxURLs --> Views

    Views -->|"ORM query"| Models
    Models --> DB
    Views -->|"detectIntent API call"| Dialogflow
    Dialogflow -->|"JSON response"| Views
    Views --> UI

    %% Admin Flow
    UI -->|"HTTP GET /admin"| ProjectURLs
    ProjectURLs --> Admin
    Admin --> Models
    Models --> DB

    %% Click Events
    click UI "https://github.com/neel5252/neelchatbot/blob/bot/chatbox/templates/index.html"
    click Ngrok "https://github.com/neel5252/neelchatbot/blob/bot/ngrok.exe"
    click ASGI "https://github.com/neel5252/neelchatbot/blob/bot/foodchatbox/asgi.py"
    click WSGI "https://github.com/neel5252/neelchatbot/blob/bot/foodchatbox/wsgi.py"
    click Settings "https://github.com/neel5252/neelchatbot/blob/bot/foodchatbox/settings.py"
    click ProjectURLs "https://github.com/neel5252/neelchatbot/blob/bot/foodchatbox/urls.py"
    click ChatboxURLs "https://github.com/neel5252/neelchatbot/blob/bot/chatbox/urls.py"
    click Models "https://github.com/neel5252/neelchatbot/blob/bot/chatbox/models.py"
    click Views "https://github.com/neel5252/neelchatbot/blob/bot/chatbox/views.py"
    click Admin "https://github.com/neel5252/neelchatbot/blob/bot/chatbox/admin.py"
    click Apps "https://github.com/neel5252/neelchatbot/blob/bot/chatbox/apps.py"
    click DB "https://github.com/neel5252/neelchatbot/blob/bot/db.sqlite3"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366D6,color:#0366D6;
    classDef backend fill:#DFFFE0,stroke:#28A745,color:#28A745;
    classDef database fill:#FFF5BA,stroke:#DBAB09,color:#8A6D09,stroke-dasharray: 5 5;
    classDef external fill:#FFE4CC,stroke:#D2691E,color:#D2691E;
    classDef dev fill:#E2E2E2,stroke:#6A737D,color:#6A737D;
```
