# diptaaaa/chatbot-dipta architecture

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

- Interactive diagram: https://gitdiagram.com/diptaaaa/chatbot-dipta
- Repository: https://github.com/diptaaaa/chatbot-dipta

## Overview

Dipta AI is a PHP web chatbot. Users open a room, view its conversation, submit a prompt, and receive a Groq-generated reply; chat history and room titles are stored in MySQL. The graph includes the documented room-management and Markdown/code-rendering features. Source excerpts confirm the main page, AJAX flow, and AI integration; wiring for some room-management actions is not fully visible, so those links are omitted.

Main entry points: [`index.php`](https://github.com/diptaaaa/chatbot-dipta/blob/main/index.php) (Chat page), [`chat-ajax.php`](https://github.com/diptaaaa/chatbot-dipta/blob/main/chat-ajax.php) (Chat AJAX endpoint), [`config.php`](https://github.com/diptaaaa/chatbot-dipta/blob/main/config.php) (Config and DB connection), [`groq.php`](https://github.com/diptaaaa/chatbot-dipta/blob/main/groq.php) (AI request helper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Chat experience"]
  node_main["Chat page<br/>[index.php]"]
  node_styles["Chat styling<br/>[style.css]"]
  node_markdown["Markdown rendering<br/>[index.php]"]
end

subgraph group_server["PHP application"]
  node_api_main["Serverless page route<br/>[index.php]"]
  node_chat_api["Chat AJAX endpoint<br/>[chat-ajax.php]"]
  node_api_chat["Serverless chat route<br/>[chat-ajax.php]"]
  node_config["Config and DB connection<br/>[config.php]"]
end

subgraph group_ai["AI integration"]
  node_groq_helper["AI request helper<br/>[groq.php]"]
end

subgraph group_data["Conversation data"]
  node_mysql[("MySQL database<br/>[database.sql]")]
end

node_user(("User"))
node_marked["Marked.js"]
node_highlight["Highlight.js"]
node_groq_service{{"Groq Cloud"}}

node_user -->|"opens and uses"| node_main
node_main -->|"loads styles"| node_styles
node_main -->|"loads configuration"| node_config
node_main -->|"reads rooms and history"| node_mysql
node_main -->|"submits prompts"| node_chat_api
node_chat_api -->|"loads configuration"| node_config
node_config -->|"connects to"| node_mysql
node_chat_api -->|"checks room; stores messages and title"| node_mysql
node_chat_api -->|"requests reply with history"| node_groq_helper
node_groq_helper -->|"reads AI settings"| node_config
node_groq_helper -->|"sends completion request"| node_groq_service
node_chat_api -->|"returns JSON reply"| node_main
node_main -->|"renders conversation"| node_markdown
node_markdown -->|"parses Markdown"| node_marked
node_markdown -->|"highlights code"| node_highlight
node_api_main -->|"includes page entry"| node_main
node_api_chat -->|"includes chat entry"| node_chat_api

click node_main "https://github.com/diptaaaa/chatbot-dipta/blob/main/index.php"
click node_styles "https://github.com/diptaaaa/chatbot-dipta/blob/main/style.css"
click node_markdown "https://github.com/diptaaaa/chatbot-dipta/blob/main/index.php"
click node_api_main "https://github.com/diptaaaa/chatbot-dipta/blob/main/api/index.php"
click node_chat_api "https://github.com/diptaaaa/chatbot-dipta/blob/main/chat-ajax.php"
click node_api_chat "https://github.com/diptaaaa/chatbot-dipta/blob/main/api/chat-ajax.php"
click node_config "https://github.com/diptaaaa/chatbot-dipta/blob/main/config.php"
click node_groq_helper "https://github.com/diptaaaa/chatbot-dipta/blob/main/groq.php"
click node_mysql "https://github.com/diptaaaa/chatbot-dipta/blob/main/database.sql"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_styles,node_markdown,node_user toneBlue
class node_api_main,node_chat_api,node_api_chat,node_config toneAmber
class node_groq_helper toneMint
class node_mysql toneRose
class node_marked,node_highlight,node_groq_service toneIndigo
```

## Components

### Chat experience

- [Chat page](https://github.com/diptaaaa/chatbot-dipta/blob/main/index.php): `index.php`
- [Chat styling](https://github.com/diptaaaa/chatbot-dipta/blob/main/style.css): `style.css`
- [Markdown rendering](https://github.com/diptaaaa/chatbot-dipta/blob/main/index.php): `index.php`

### PHP application

- [Serverless page route](https://github.com/diptaaaa/chatbot-dipta/blob/main/api/index.php): `api/index.php`
- [Chat AJAX endpoint](https://github.com/diptaaaa/chatbot-dipta/blob/main/chat-ajax.php): `chat-ajax.php`
- [Serverless chat route](https://github.com/diptaaaa/chatbot-dipta/blob/main/api/chat-ajax.php): `api/chat-ajax.php`
- [Config and DB connection](https://github.com/diptaaaa/chatbot-dipta/blob/main/config.php): `config.php`

### AI integration

- [AI request helper](https://github.com/diptaaaa/chatbot-dipta/blob/main/groq.php): `groq.php`

### Conversation data

- [MySQL database](https://github.com/diptaaaa/chatbot-dipta/blob/main/database.sql): `database.sql`

### Other components

- **User**
- **Marked.js**
- **Highlight.js**
- **Groq Cloud**

## Connections

- User → Chat page: opens and uses
- Chat page → Chat styling: loads styles
- Chat page → Config and DB connection: loads configuration
- Chat page → MySQL database: reads rooms and history
- Chat page → Chat AJAX endpoint: submits prompts
- Chat AJAX endpoint → Config and DB connection: loads configuration
- Config and DB connection → MySQL database: connects to
- Chat AJAX endpoint → MySQL database: checks room; stores messages and title
- Chat AJAX endpoint → AI request helper: requests reply with history
- AI request helper → Config and DB connection: reads AI settings
- AI request helper → Groq Cloud: sends completion request
- Chat AJAX endpoint → Chat page: returns JSON reply
- Chat page → Markdown rendering: renders conversation
- Markdown rendering → Marked.js: parses Markdown
- Markdown rendering → Highlight.js: highlights code
- Serverless page route → Chat page: includes page entry
- Serverless chat route → Chat AJAX endpoint: includes chat entry
