# mehreen-14/bhromor-chatbot architecture

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

- Interactive diagram: https://gitdiagram.com/mehreen-14/bhromor-chatbot
- Repository: https://github.com/mehreen-14/bhromor-chatbot

## Overview

Bhromor is a web chatbot: users send messages, the backend routes weather questions to a weather service and other questions to OpenRouter, then saves exchanges for chat history and search. The React app also supports starting and revisiting chats, dark mode, and message search. README capabilities are included where documented; source excerpts show the chat, history, and search routes, but not an implemented Google search-results flow or model use of prior turns.

Main entry points: [`frontend/src/App.js`](https://github.com/mehreen-14/bhromor-chatbot/blob/main/frontend/src/App.js) (Chat and controls), [`backend/server.js`](https://github.com/mehreen-14/bhromor-chatbot/blob/main/backend/server.js) (Chat route), [`frontend/src/index.js`](https://github.com/mehreen-14/bhromor-chatbot/blob/main/frontend/src/index.js) (React entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Chat interface"]
  node_app_entry["React entry<br/>[index.js]"]
  node_chat_ui["Chat and controls<br/>[App.js]"]
end

subgraph group_backend["Request handling"]
  node_chat_api["Chat route<br/>[server.js]"]
  node_history_api["History route<br/>[server.js]"]
  node_search_api["Search route<br/>[server.js]"]
end

subgraph group_storage["Chat persistence"]
  node_chat_store[("Chat records<br/>[server.js]")]
end

subgraph group_services["External services"]
  node_openrouter["OpenRouter LLM"]
  node_weather["WeatherAPI"]
  node_google_search["Google search script"]
end

node_user(("Chat user"))

node_user -->|"opens app"| node_app_entry
node_app_entry -->|"renders"| node_chat_ui
node_user -->|"uses controls"| node_chat_ui
node_chat_ui -->|"sends messages"| node_chat_api
node_chat_api -->|"requests completion"| node_openrouter
node_chat_api -->|"requests forecast"| node_weather
node_chat_api -->|"reads and writes"| node_chat_store
node_chat_ui -->|"loads chats"| node_history_api
node_history_api -->|"reads chats"| node_chat_store
node_chat_ui -->|"searches messages"| node_search_api
node_search_api -->|"queries chats"| node_chat_store
node_chat_ui -.->|"loads script"| node_google_search

click node_app_entry "https://github.com/mehreen-14/bhromor-chatbot/blob/main/frontend/src/index.js"
click node_chat_ui "https://github.com/mehreen-14/bhromor-chatbot/blob/main/frontend/src/App.js"
click node_chat_api "https://github.com/mehreen-14/bhromor-chatbot/blob/main/backend/server.js"
click node_history_api "https://github.com/mehreen-14/bhromor-chatbot/blob/main/backend/server.js"
click node_search_api "https://github.com/mehreen-14/bhromor-chatbot/blob/main/backend/server.js"
click node_chat_store "https://github.com/mehreen-14/bhromor-chatbot/blob/main/backend/server.js"

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_app_entry,node_chat_ui,node_user toneBlue
class node_chat_api,node_history_api,node_search_api toneAmber
class node_chat_store toneMint
class node_openrouter,node_weather,node_google_search toneRose
```

## Components

### Chat interface

- [React entry](https://github.com/mehreen-14/bhromor-chatbot/blob/main/frontend/src/index.js): `frontend/src/index.js`
- [Chat and controls](https://github.com/mehreen-14/bhromor-chatbot/blob/main/frontend/src/App.js): `frontend/src/App.js`

### Request handling

- [Chat route](https://github.com/mehreen-14/bhromor-chatbot/blob/main/backend/server.js): `backend/server.js`
- [History route](https://github.com/mehreen-14/bhromor-chatbot/blob/main/backend/server.js): `backend/server.js`
- [Search route](https://github.com/mehreen-14/bhromor-chatbot/blob/main/backend/server.js): `backend/server.js`

### Chat persistence

- [Chat records](https://github.com/mehreen-14/bhromor-chatbot/blob/main/backend/server.js): `backend/server.js`

### External services

- **OpenRouter LLM**
- **WeatherAPI**
- **Google search script**

### Other components

- **Chat user**

## Connections

- Chat user → React entry: opens app (evidence: `frontend/src/index.js`)
- React entry → Chat and controls: renders (evidence: `frontend/src/index.js`)
- Chat user → Chat and controls: uses controls (evidence: `frontend/src/App.js`)
- Chat and controls → Chat route: sends messages (evidence: `frontend/src/App.js`)
- Chat route → OpenRouter LLM: requests completion (evidence: `backend/server.js`)
- Chat route → WeatherAPI: requests forecast (evidence: `backend/server.js`)
- Chat route → Chat records: reads and writes (evidence: `backend/server.js`)
- Chat and controls → History route: loads chats (evidence: `frontend/src/App.js`)
- History route → Chat records: reads chats (evidence: `backend/server.js`)
- Chat and controls → Search route: searches messages (evidence: `frontend/src/App.js`)
- Search route → Chat records: queries chats (evidence: `backend/server.js`)
- Chat and controls → Google search script: loads script (evidence: `frontend/src/App.js`)
