# prohirenetworks/ai-engineer-workshop architecture

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

- Interactive diagram: https://gitdiagram.com/prohirenetworks/ai-engineer-workshop
- Repository: https://github.com/prohirenetworks/ai-engineer-workshop

## Overview

This is a customer-support chat application: users submit a message, the backend validates it, classifies it with a structured LLM response, estimates tokens, loads recent conversation history, generates a Markdown answer, and saves the exchange. The React app also supports saved-chat navigation, connection status, and intent/risk insights. Backend call ownership is visible in the API route; several frontend component relationships and endpoint contracts are supported by the source index and README rather than full excerpts.

Main entry points: [`backend/app/main.py`](https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/backend/app/main.py) (API routes), [`frontend-react/src/pages/Chat.jsx`](https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/frontend-react/src/pages/Chat.jsx) (Chat workspace), [`frontend-react/src/components/MessageList.jsx`](https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/frontend-react/src/components/MessageList.jsx) (Message display), [`backend/app/services/llm_service.py`](https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/backend/app/services/llm_service.py) (Intent classifier)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["React experience"]
  node_app["App routing<br/>[App.jsx]"]
  node_landing["Landing page<br/>[Landing.jsx]"]
  node_chat["Chat workspace<br/>[Chat.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_message_list["Message display<br/>[MessageList.jsx]"]
  node_insights["Intent insights<br/>[InsightsPanel.jsx]"]
  node_sidebar["Chat navigation<br/>[Sidebar.jsx]"]
  node_copy["Copy answer<br/>[CopyButton.jsx]"]
  node_markdown["Markdown rendering<br/>[Markdown.jsx]"]
  node_theme["Theme control<br/>[ThemeToggle.jsx]"]
  node_display_helpers["Intent and time labels"]
end

subgraph group_api["API orchestration"]
  node_routes["API routes<br/>[main.py]"]
  node_request_schema["Request validation<br/>[ingestion.py]"]
  node_result_schema["Assistant result<br/>[assistant.py]"]
  node_settings["Runtime settings<br/>[config.py]"]
end

subgraph group_intelligence["Message intelligence"]
  node_classifier["Intent classifier<br/>[llm_service.py]"]
  node_token_estimator["Token estimate<br/>[token_counter.py]"]
  node_answer_writer["Response generation"]
end

subgraph group_memory["Conversation memory"]
  node_history_service["Conversation storage"]
end

node_visitor(("Chat user"))
node_groq{{"Groq LLM"}}
node_sqlite[("SQLite database")]

node_visitor -->|"opens"| node_app
node_app -->|"routes to"| node_landing
node_app -->|"routes to"| node_chat
node_chat -->|"requests through"| node_api_client
node_chat -->|"renders"| node_message_list
node_chat -->|"renders"| node_insights
node_chat -->|"renders"| node_sidebar
node_api_client -->|"calls endpoints"| node_routes
node_routes -->|"validates input"| node_request_schema
node_routes -->|"classifies message"| node_classifier
node_classifier -->|"returns validated result"| node_request_schema
node_routes -->|"estimates tokens"| node_token_estimator
node_routes -->|"loads history"| node_history_service
node_routes -->|"generates reply"| node_answer_writer
node_routes -->|"saves messages"| node_history_service
node_routes -->|"returns response model"| node_result_schema
node_classifier -->|"calls"| node_groq
node_answer_writer -->|"calls"| node_groq
node_history_service -->|"reads and writes"| node_sqlite
node_classifier -->|"reads credentials"| node_settings
node_answer_writer -->|"reads credentials"| node_settings
node_history_service -->|"reads database path"| node_settings
node_message_list -->|"renders"| node_copy
node_message_list -->|"renders"| node_markdown
node_message_list -->|"formats labels"| node_display_helpers
node_insights -->|"uses intent labels"| node_display_helpers
node_sidebar -->|"renders"| node_theme
node_landing -->|"renders"| node_theme

click node_app "https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/frontend-react/src/App.jsx"
click node_landing "https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/frontend-react/src/pages/Landing.jsx"
click node_chat "https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/frontend-react/src/pages/Chat.jsx"
click node_api_client "https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/frontend-react/src/lib/api.js"
click node_message_list "https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/frontend-react/src/components/MessageList.jsx"
click node_insights "https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/frontend-react/src/components/InsightsPanel.jsx"
click node_sidebar "https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/frontend-react/src/components/Sidebar.jsx"
click node_copy "https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/frontend-react/src/components/CopyButton.jsx"
click node_markdown "https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/frontend-react/src/components/Markdown.jsx"
click node_theme "https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/frontend-react/src/components/ThemeToggle.jsx"
click node_display_helpers "https://github.com/prohirenetworks/ai-engineer-workshop/tree/main/frontend-react/src/lib"
click node_routes "https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/backend/app/main.py"
click node_request_schema "https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/backend/app/schemas/ingestion.py"
click node_result_schema "https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/backend/app/schemas/assistant.py"
click node_classifier "https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/backend/app/services/llm_service.py"
click node_token_estimator "https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/backend/app/utils/token_counter.py"
click node_answer_writer "https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/backend/app/services/response_service.py"
click node_history_service "https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/backend/app/services/database_service.py"
click node_settings "https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/backend/app/config.py"

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,node_landing,node_chat,node_api_client,node_message_list,node_insights,node_sidebar,node_copy,node_markdown,node_theme,node_display_helpers,node_visitor toneBlue
class node_routes,node_request_schema,node_result_schema,node_settings,node_sqlite toneAmber
class node_classifier,node_token_estimator,node_answer_writer toneMint
class node_history_service toneRose
class node_groq toneIndigo
```

## Components

### React experience

- [App routing](https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/frontend-react/src/App.jsx): `frontend-react/src/App.jsx`
- [Landing page](https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/frontend-react/src/pages/Landing.jsx): `frontend-react/src/pages/Landing.jsx`
- [Chat workspace](https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/frontend-react/src/pages/Chat.jsx): `frontend-react/src/pages/Chat.jsx`
- [API client](https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/frontend-react/src/lib/api.js): `frontend-react/src/lib/api.js`
- [Message display](https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/frontend-react/src/components/MessageList.jsx): `frontend-react/src/components/MessageList.jsx`
- [Intent insights](https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/frontend-react/src/components/InsightsPanel.jsx): `frontend-react/src/components/InsightsPanel.jsx`
- [Chat navigation](https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/frontend-react/src/components/Sidebar.jsx): `frontend-react/src/components/Sidebar.jsx`
- [Copy answer](https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/frontend-react/src/components/CopyButton.jsx): `frontend-react/src/components/CopyButton.jsx`
- [Markdown rendering](https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/frontend-react/src/components/Markdown.jsx): `frontend-react/src/components/Markdown.jsx`
- [Theme control](https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/frontend-react/src/components/ThemeToggle.jsx): `frontend-react/src/components/ThemeToggle.jsx`
- [Intent and time labels](https://github.com/prohirenetworks/ai-engineer-workshop/tree/main/frontend-react/src/lib): `frontend-react/src/lib`

### API orchestration

- [API routes](https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/backend/app/main.py): `backend/app/main.py`
- [Request validation](https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/backend/app/schemas/ingestion.py): `backend/app/schemas/ingestion.py`
- [Assistant result](https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/backend/app/schemas/assistant.py): `backend/app/schemas/assistant.py`
- [Runtime settings](https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/backend/app/config.py): `backend/app/config.py`

### Message intelligence

- [Intent classifier](https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/backend/app/services/llm_service.py): `backend/app/services/llm_service.py`
- [Token estimate](https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/backend/app/utils/token_counter.py): `backend/app/utils/token_counter.py`
- [Response generation](https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/backend/app/services/response_service.py): `backend/app/services/response_service.py`

### Conversation memory

- [Conversation storage](https://github.com/prohirenetworks/ai-engineer-workshop/blob/main/backend/app/services/database_service.py): `backend/app/services/database_service.py`

### Other components

- **Chat user**
- **Groq LLM**
- **SQLite database**

## Connections

- Chat user → App routing: opens (evidence: `README.md`)
- App routing → Landing page: routes to (evidence: `frontend-react/src/App.jsx`)
- App routing → Chat workspace: routes to (evidence: `frontend-react/src/App.jsx`)
- Chat workspace → API client: requests through (evidence: `frontend-react/src/pages/Chat.jsx`)
- Chat workspace → Message display: renders (evidence: `frontend-react/src/pages/Chat.jsx`)
- Chat workspace → Intent insights: renders (evidence: `frontend-react/src/pages/Chat.jsx`)
- Chat workspace → Chat navigation: renders (evidence: `frontend-react/src/pages/Chat.jsx`)
- API client → API routes: calls endpoints (evidence: `README.md`)
- API routes → Request validation: validates input (evidence: `backend/app/main.py`)
- API routes → Intent classifier: classifies message (evidence: `backend/app/main.py`)
- Intent classifier → Request validation: returns validated result (evidence: `backend/app/services/llm_service.py`)
- API routes → Token estimate: estimates tokens (evidence: `backend/app/main.py`)
- API routes → Conversation storage: loads history (evidence: `backend/app/main.py`)
- API routes → Response generation: generates reply (evidence: `backend/app/main.py`)
- API routes → Conversation storage: saves messages (evidence: `backend/app/main.py`)
- API routes → Assistant result: returns response model (evidence: `backend/app/main.py`)
- Intent classifier → Groq LLM: calls (evidence: `backend/app/services/llm_service.py`)
- Response generation → Groq LLM: calls (evidence: `backend/app/services/response_service.py`)
- Conversation storage → SQLite database: reads and writes (evidence: `backend/app/services/database_service.py`)
- Intent classifier → Runtime settings: reads credentials (evidence: `backend/app/services/llm_service.py`)
- Response generation → Runtime settings: reads credentials (evidence: `backend/app/services/response_service.py`)
- Conversation storage → Runtime settings: reads database path (evidence: `backend/app/services/database_service.py`)
- Message display → Copy answer: renders (evidence: `frontend-react/src/components/MessageList.jsx`)
- Message display → Markdown rendering: renders (evidence: `frontend-react/src/components/MessageList.jsx`)
- Message display → Intent and time labels: formats labels (evidence: `frontend-react/src/components/MessageList.jsx`)
- Intent insights → Intent and time labels: uses intent labels (evidence: `frontend-react/src/components/InsightsPanel.jsx`)
- Chat navigation → Theme control: renders (evidence: `frontend-react/src/components/Sidebar.jsx`)
- Landing page → Theme control: renders (evidence: `frontend-react/src/pages/Landing.jsx`)
