# shifanhusen/innovitech_ai architecture

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

- Interactive diagram: https://gitdiagram.com/shifanhusen/innovitech_ai
- Repository: https://github.com/shifanhusen/innovitech_ai

## Overview

This is a web-based AI assistant: a browser chat workflow sends messages through the React UI and Nginx to FastAPI, which combines conversation history with optional web search or scraping context, builds a prompt, calls Ollama, and stores the exchange in Redis. The API also exposes session reset/history and health endpoints. The README documents the deployment topology; sampled source supports the chat, search, scraping, memory, and inference wiring, but not the detailed frontend-to-Nginx configuration.

Main entry points: [`backend/app/api/routes_chat.py`](https://github.com/shifanhusen/innovitech_ai/blob/main/backend/app/api/routes_chat.py) (Chat endpoints), [`nginx/conf.d/default.conf`](https://github.com/shifanhusen/innovitech_ai/blob/main/nginx/conf.d/default.conf) (Nginx proxy), [`backend/app/main.py`](https://github.com/shifanhusen/innovitech_ai/blob/main/backend/app/main.py) (FastAPI app), [`frontend/src/components/Chat.tsx`](https://github.com/shifanhusen/innovitech_ai/blob/main/frontend/src/components/Chat.tsx) (Chat UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Chat interface"]
  node_chat_ui["Chat UI<br/>[Chat.tsx]"]
  node_app["React app<br/>[App.tsx]"]
  node_main["React entry<br/>[main.tsx]"]
end

subgraph group_api["API orchestration"]
  node_api_app["FastAPI app<br/>[main.py]"]
  node_chat_api["Chat endpoints<br/>[routes_chat.py]"]
  node_health_api["Health endpoint<br/>[routes_health.py]"]
end

subgraph group_intelligence["Assistant services"]
  node_search["Web search<br/>[search_service.py]"]
  node_scrape["Page scraping<br/>[scrape_service.py]"]
  node_prompt["Prompt builder<br/>[prompt_builder.py]"]
  node_ollama_service["Inference client<br/>[ollama_service.py]"]
end

subgraph group_state["Session state"]
  node_memory["Memory service<br/>[memory_service.py]"]
  node_redis[("Redis sessions")]
end

subgraph group_delivery["Edge delivery"]
  node_nginx["Nginx proxy<br/>[default.conf]"]
end

node_browser(("Browser user"))
node_duckduckgo["DuckDuckGo"]
node_websites["Web pages"]
node_ollama["Ollama model"]

node_browser -->|"uses"| node_nginx
node_nginx -->|"serves UI"| node_main
node_main -->|"renders"| node_app
node_app -->|"renders"| node_chat_ui
node_chat_ui -->|"sends chat"| node_nginx
node_nginx -->|"proxies API"| node_api_app
node_api_app -->|"mounts routes"| node_chat_api
node_api_app -->|"mounts routes"| node_health_api
node_chat_api -->|"reads/writes"| node_memory
node_memory -->|"stores history"| node_redis
node_chat_api -->|"searches when needed"| node_search
node_search -->|"queries"| node_duckduckgo
node_chat_api -->|"scrapes on request"| node_scrape
node_scrape -->|"fetches pages"| node_websites
node_chat_api -->|"builds prompt"| node_prompt
node_chat_api -->|"requests inference"| node_ollama_service
node_ollama_service -->|"generates reply"| node_ollama

click node_nginx "https://github.com/shifanhusen/innovitech_ai/blob/main/nginx/conf.d/default.conf"
click node_chat_ui "https://github.com/shifanhusen/innovitech_ai/blob/main/frontend/src/components/Chat.tsx"
click node_app "https://github.com/shifanhusen/innovitech_ai/blob/main/frontend/src/App.tsx"
click node_main "https://github.com/shifanhusen/innovitech_ai/blob/main/frontend/src/main.tsx"
click node_api_app "https://github.com/shifanhusen/innovitech_ai/blob/main/backend/app/main.py"
click node_chat_api "https://github.com/shifanhusen/innovitech_ai/blob/main/backend/app/api/routes_chat.py"
click node_health_api "https://github.com/shifanhusen/innovitech_ai/blob/main/backend/app/api/routes_health.py"
click node_memory "https://github.com/shifanhusen/innovitech_ai/blob/main/backend/app/services/memory_service.py"
click node_search "https://github.com/shifanhusen/innovitech_ai/blob/main/backend/app/services/search_service.py"
click node_scrape "https://github.com/shifanhusen/innovitech_ai/blob/main/backend/app/services/scrape_service.py"
click node_prompt "https://github.com/shifanhusen/innovitech_ai/blob/main/backend/app/utils/prompt_builder.py"
click node_ollama_service "https://github.com/shifanhusen/innovitech_ai/blob/main/backend/app/services/ollama_service.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_chat_ui,node_app,node_main,node_browser toneBlue
class node_api_app,node_chat_api,node_health_api toneAmber
class node_search,node_scrape,node_prompt,node_ollama_service toneMint
class node_memory,node_redis toneRose
class node_nginx,node_duckduckgo,node_websites,node_ollama toneIndigo
```

## Components

### Chat interface

- [Chat UI](https://github.com/shifanhusen/innovitech_ai/blob/main/frontend/src/components/Chat.tsx): `frontend/src/components/Chat.tsx`
- [React app](https://github.com/shifanhusen/innovitech_ai/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [React entry](https://github.com/shifanhusen/innovitech_ai/blob/main/frontend/src/main.tsx): `frontend/src/main.tsx`

### API orchestration

- [FastAPI app](https://github.com/shifanhusen/innovitech_ai/blob/main/backend/app/main.py): `backend/app/main.py`
- [Chat endpoints](https://github.com/shifanhusen/innovitech_ai/blob/main/backend/app/api/routes_chat.py): `backend/app/api/routes_chat.py`
- [Health endpoint](https://github.com/shifanhusen/innovitech_ai/blob/main/backend/app/api/routes_health.py): `backend/app/api/routes_health.py`

### Assistant services

- [Web search](https://github.com/shifanhusen/innovitech_ai/blob/main/backend/app/services/search_service.py): `backend/app/services/search_service.py`
- [Page scraping](https://github.com/shifanhusen/innovitech_ai/blob/main/backend/app/services/scrape_service.py): `backend/app/services/scrape_service.py`
- [Prompt builder](https://github.com/shifanhusen/innovitech_ai/blob/main/backend/app/utils/prompt_builder.py): `backend/app/utils/prompt_builder.py`
- [Inference client](https://github.com/shifanhusen/innovitech_ai/blob/main/backend/app/services/ollama_service.py): `backend/app/services/ollama_service.py`

### Session state

- [Memory service](https://github.com/shifanhusen/innovitech_ai/blob/main/backend/app/services/memory_service.py): `backend/app/services/memory_service.py`
- **Redis sessions**

### Edge delivery

- [Nginx proxy](https://github.com/shifanhusen/innovitech_ai/blob/main/nginx/conf.d/default.conf): `nginx/conf.d/default.conf`

### Other components

- **Browser user**
- **DuckDuckGo**
- **Web pages**
- **Ollama model**

## Connections

- Browser user → Nginx proxy: uses
- Nginx proxy → React entry: serves UI
- React entry → React app: renders
- React app → Chat UI: renders
- Chat UI → Nginx proxy: sends chat
- Nginx proxy → FastAPI app: proxies API
- FastAPI app → Chat endpoints: mounts routes
- FastAPI app → Health endpoint: mounts routes
- Chat endpoints → Memory service: reads/writes
- Memory service → Redis sessions: stores history
- Chat endpoints → Web search: searches when needed
- Web search → DuckDuckGo: queries
- Chat endpoints → Page scraping: scrapes on request
- Page scraping → Web pages: fetches pages
- Chat endpoints → Prompt builder: builds prompt
- Chat endpoints → Inference client: requests inference
- Inference client → Ollama model: generates reply
