# anishvermaishere/look-chat architecture

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

- Interactive diagram: https://gitdiagram.com/anishvermaishere/look-chat
- Repository: https://github.com/anishvermaishere/look-chat

## Overview

Look AI is a React/FastAPI chat product. Users register or log in, enter the chat interface, manage chat history, send messages, and receive streamed AI responses rendered with markdown and reasoning indicators. The backend separates HTTP routing, controllers, domain services, model-provider integration, and persistence; the frontend separates routes, chat UI/state, and API clients. Several backend relationships are supported by the source index, while frontend and unsampled implementation links rely on README capability statements; those links are shown as documented rather than inspected call paths.

Main entry points: [`be/app/services/chat.py`](https://github.com/anishvermaishere/look-chat/blob/master/be/app/services/chat.py) (Chat service), [`fe/src/features/chat/components/chat-panel.tsx`](https://github.com/anishvermaishere/look-chat/blob/master/fe/src/features/chat/components/chat-panel.tsx) (Chat panel), [`be/app/routes/chat.py`](https://github.com/anishvermaishere/look-chat/blob/master/be/app/routes/chat.py) (Chat routes), [`be/app/services/auth.py`](https://github.com/anishvermaishere/look-chat/blob/master/be/app/services/auth.py) (Auth service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_app_routes["App routes<br/>[app-routes.tsx]"]
  node_chat_page["Chat page<br/>[chat.tsx]"]
  node_chat_panel["Chat panel<br/>[chat-panel.tsx]"]
  node_chat_messages["Message renderer<br/>[chat-messages.tsx]"]
  node_chat_provider["Chat state<br/>[chat-provider.tsx]"]
  node_chat_api["Chat API client<br/>[chat.ts]"]
  node_searchbar["Chat search<br/>[searchbar.tsx]"]
  node_auth_ui["Login and registration<br/>[login.tsx]"]
  node_auth_api["Auth API client<br/>[auth.ts]"]
end

subgraph group_api["API and identity"]
  node_chat_routes["Chat routes<br/>[chat.py]"]
  node_auth_routes["Auth routes<br/>[auth.py]"]
  node_user_routes["User routes<br/>[user.py]"]
  node_auth_middleware["JWT middleware<br/>[auth.py]"]
  node_chat_controller["Chat controller<br/>[chat.py]"]
  node_auth_controller["Auth controller<br/>[auth.py]"]
  node_auth_service["Auth service<br/>[auth.py]"]
end

subgraph group_chat_domain["Chat domain"]
  node_chat_service["Chat service<br/>[chat.py]"]
  node_message_service["Message service<br/>[message.py]"]
  node_assistant_service["Assistant service<br/>[assistant.py]"]
  node_ai_service["AI service<br/>[ai.py]"]
end

subgraph group_runtime["Runtime integrations"]
  node_llm_provider["OpenAI provider<br/>[open_ai.py]"]
  node_cache[("Redis cache<br/>[cache.py]")]
  node_redis_adapter["Cache adapter<br/>[redis.py]"]
  node_jwt_service["JWT service<br/>[jwt.py]"]
end

subgraph group_persistence["Persistence"]
  node_db_session[("Database sessions<br/>[database.py]")]
  node_chat_model[("Chat records<br/>[chat.py]")]
  node_message_model[("Message records<br/>[message.py]")]
  node_user_model[("User records<br/>[user.py]")]
end

node_user(("Chat user"))

node_user -->|"opens app"| node_app_routes
node_app_routes -->|"routes to"| node_chat_page
node_chat_page -.->|"shows chat"| node_chat_panel
node_chat_panel -.->|"uses state"| node_chat_provider
node_chat_panel -.->|"renders messages"| node_chat_messages
node_chat_panel -.->|"sends requests"| node_chat_api
node_chat_panel -.->|"offers search"| node_searchbar
node_chat_api -.->|"calls API"| node_chat_routes
node_user -->|"registers or logs in"| node_auth_ui
node_auth_ui -.->|"submits credentials"| node_auth_api
node_auth_api -.->|"calls API"| node_auth_routes
node_auth_routes -->|"delegates"| node_auth_controller
node_auth_controller -->|"invokes"| node_auth_service
node_auth_service -->|"queries users"| node_user_model
node_auth_service -->|"creates tokens"| node_jwt_service
node_auth_routes -->|"gets session"| node_db_session
node_user -->|"sends messages"| node_chat_panel
node_chat_routes -->|"delegates"| node_chat_controller
node_chat_controller -.->|"invokes"| node_chat_service
node_chat_service -->|"uses records"| node_chat_model
node_chat_service -->|"uses records"| node_message_model
node_chat_service -->|"uses service"| node_message_service
node_chat_service -->|"uses service"| node_assistant_service
node_chat_service -->|"requests AI"| node_ai_service
node_chat_service -->|"uses provider"| node_llm_provider
node_chat_routes -->|"gets session"| node_db_session
node_chat_service -->|"streams response"| node_chat_panel
node_chat_panel -->|"renders markdown"| node_chat_messages
node_chat_routes -->|"protected by"| node_auth_middleware
node_auth_middleware -->|"verifies token"| node_jwt_service
node_user_routes -->|"uses controller"| node_chat_controller
node_user_routes -->|"protected by"| node_auth_middleware
node_auth_service -->|"caches profile"| node_cache
node_cache -->|"constructs adapter"| node_redis_adapter
node_db_session -->|"backs records"| node_user_model
node_db_session -->|"backs records"| node_message_model

click node_app_routes "https://github.com/anishvermaishere/look-chat/blob/master/fe/src/routes/app-routes.tsx"
click node_chat_page "https://github.com/anishvermaishere/look-chat/blob/master/fe/src/pages/chat.tsx"
click node_chat_panel "https://github.com/anishvermaishere/look-chat/blob/master/fe/src/features/chat/components/chat-panel.tsx"
click node_chat_messages "https://github.com/anishvermaishere/look-chat/blob/master/fe/src/features/chat/components/chat-messages.tsx"
click node_chat_provider "https://github.com/anishvermaishere/look-chat/blob/master/fe/src/features/chat/provider/chat-provider.tsx"
click node_chat_api "https://github.com/anishvermaishere/look-chat/blob/master/fe/src/features/chat/services/apis/chat.ts"
click node_searchbar "https://github.com/anishvermaishere/look-chat/blob/master/fe/src/features/chat/components/searchbar.tsx"
click node_auth_ui "https://github.com/anishvermaishere/look-chat/blob/master/fe/src/components/login.tsx"
click node_auth_api "https://github.com/anishvermaishere/look-chat/blob/master/fe/src/services/apis/auth.ts"
click node_chat_routes "https://github.com/anishvermaishere/look-chat/blob/master/be/app/routes/chat.py"
click node_auth_routes "https://github.com/anishvermaishere/look-chat/blob/master/be/app/routes/auth.py"
click node_user_routes "https://github.com/anishvermaishere/look-chat/blob/master/be/app/routes/user.py"
click node_auth_middleware "https://github.com/anishvermaishere/look-chat/blob/master/be/app/middleware/auth.py"
click node_chat_controller "https://github.com/anishvermaishere/look-chat/blob/master/be/app/controllers/chat.py"
click node_auth_controller "https://github.com/anishvermaishere/look-chat/blob/master/be/app/controllers/auth.py"
click node_chat_service "https://github.com/anishvermaishere/look-chat/blob/master/be/app/services/chat.py"
click node_message_service "https://github.com/anishvermaishere/look-chat/blob/master/be/app/services/message.py"
click node_assistant_service "https://github.com/anishvermaishere/look-chat/blob/master/be/app/services/assistant.py"
click node_ai_service "https://github.com/anishvermaishere/look-chat/blob/master/be/app/services/ai.py"
click node_auth_service "https://github.com/anishvermaishere/look-chat/blob/master/be/app/services/auth.py"
click node_llm_provider "https://github.com/anishvermaishere/look-chat/blob/master/be/app/llm/open_ai.py"
click node_db_session "https://github.com/anishvermaishere/look-chat/blob/master/be/app/database/database.py"
click node_chat_model "https://github.com/anishvermaishere/look-chat/blob/master/be/app/database/models/chat.py"
click node_message_model "https://github.com/anishvermaishere/look-chat/blob/master/be/app/database/models/message.py"
click node_user_model "https://github.com/anishvermaishere/look-chat/blob/master/be/app/database/models/user.py"
click node_cache "https://github.com/anishvermaishere/look-chat/blob/master/be/app/core/cache.py"
click node_redis_adapter "https://github.com/anishvermaishere/look-chat/blob/master/be/app/utils/redis.py"
click node_jwt_service "https://github.com/anishvermaishere/look-chat/blob/master/be/app/utils/jwt.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_routes,node_chat_page,node_chat_panel,node_chat_messages,node_chat_provider,node_chat_api,node_searchbar,node_auth_ui,node_auth_api,node_user toneBlue
class node_chat_routes,node_auth_routes,node_user_routes,node_auth_middleware,node_chat_controller,node_auth_controller,node_auth_service toneAmber
class node_chat_service,node_message_service,node_assistant_service,node_ai_service toneMint
class node_llm_provider,node_cache,node_redis_adapter,node_jwt_service toneRose
class node_db_session,node_chat_model,node_message_model,node_user_model toneIndigo
```

## Components

### Web application

- [App routes](https://github.com/anishvermaishere/look-chat/blob/master/fe/src/routes/app-routes.tsx): `fe/src/routes/app-routes.tsx`
- [Chat page](https://github.com/anishvermaishere/look-chat/blob/master/fe/src/pages/chat.tsx): `fe/src/pages/chat.tsx`
- [Chat panel](https://github.com/anishvermaishere/look-chat/blob/master/fe/src/features/chat/components/chat-panel.tsx): `fe/src/features/chat/components/chat-panel.tsx`
- [Message renderer](https://github.com/anishvermaishere/look-chat/blob/master/fe/src/features/chat/components/chat-messages.tsx): `fe/src/features/chat/components/chat-messages.tsx`
- [Chat state](https://github.com/anishvermaishere/look-chat/blob/master/fe/src/features/chat/provider/chat-provider.tsx): `fe/src/features/chat/provider/chat-provider.tsx`
- [Chat API client](https://github.com/anishvermaishere/look-chat/blob/master/fe/src/features/chat/services/apis/chat.ts): `fe/src/features/chat/services/apis/chat.ts`
- [Chat search](https://github.com/anishvermaishere/look-chat/blob/master/fe/src/features/chat/components/searchbar.tsx): `fe/src/features/chat/components/searchbar.tsx`
- [Login and registration](https://github.com/anishvermaishere/look-chat/blob/master/fe/src/components/login.tsx): `fe/src/components/login.tsx`
- [Auth API client](https://github.com/anishvermaishere/look-chat/blob/master/fe/src/services/apis/auth.ts): `fe/src/services/apis/auth.ts`

### API and identity

- [Chat routes](https://github.com/anishvermaishere/look-chat/blob/master/be/app/routes/chat.py): `be/app/routes/chat.py`
- [Auth routes](https://github.com/anishvermaishere/look-chat/blob/master/be/app/routes/auth.py): `be/app/routes/auth.py`
- [User routes](https://github.com/anishvermaishere/look-chat/blob/master/be/app/routes/user.py): `be/app/routes/user.py`
- [JWT middleware](https://github.com/anishvermaishere/look-chat/blob/master/be/app/middleware/auth.py): `be/app/middleware/auth.py`
- [Chat controller](https://github.com/anishvermaishere/look-chat/blob/master/be/app/controllers/chat.py): `be/app/controllers/chat.py`
- [Auth controller](https://github.com/anishvermaishere/look-chat/blob/master/be/app/controllers/auth.py): `be/app/controllers/auth.py`
- [Auth service](https://github.com/anishvermaishere/look-chat/blob/master/be/app/services/auth.py): `be/app/services/auth.py`

### Chat domain

- [Chat service](https://github.com/anishvermaishere/look-chat/blob/master/be/app/services/chat.py): `be/app/services/chat.py`
- [Message service](https://github.com/anishvermaishere/look-chat/blob/master/be/app/services/message.py): `be/app/services/message.py`
- [Assistant service](https://github.com/anishvermaishere/look-chat/blob/master/be/app/services/assistant.py): `be/app/services/assistant.py`
- [AI service](https://github.com/anishvermaishere/look-chat/blob/master/be/app/services/ai.py): `be/app/services/ai.py`

### Runtime integrations

- [OpenAI provider](https://github.com/anishvermaishere/look-chat/blob/master/be/app/llm/open_ai.py): `be/app/llm/open_ai.py`
- [Redis cache](https://github.com/anishvermaishere/look-chat/blob/master/be/app/core/cache.py): `be/app/core/cache.py`
- [Cache adapter](https://github.com/anishvermaishere/look-chat/blob/master/be/app/utils/redis.py): `be/app/utils/redis.py`
- [JWT service](https://github.com/anishvermaishere/look-chat/blob/master/be/app/utils/jwt.py): `be/app/utils/jwt.py`

### Persistence

- [Database sessions](https://github.com/anishvermaishere/look-chat/blob/master/be/app/database/database.py): `be/app/database/database.py`
- [Chat records](https://github.com/anishvermaishere/look-chat/blob/master/be/app/database/models/chat.py): `be/app/database/models/chat.py`
- [Message records](https://github.com/anishvermaishere/look-chat/blob/master/be/app/database/models/message.py): `be/app/database/models/message.py`
- [User records](https://github.com/anishvermaishere/look-chat/blob/master/be/app/database/models/user.py): `be/app/database/models/user.py`

### Other components

- **Chat user**

## Connections

- Chat user → App routes: opens app (evidence: `README.md`)
- App routes → Chat page: routes to (evidence: `fe/src/routes/app-routes.tsx`)
- Chat page → Chat panel: shows chat
- Chat panel → Chat state: uses state
- Chat panel → Message renderer: renders messages
- Chat panel → Chat API client: sends requests
- Chat panel → Chat search: offers search
- Chat API client → Chat routes: calls API
- Chat user → Login and registration: registers or logs in (evidence: `README.md`)
- Login and registration → Auth API client: submits credentials
- Auth API client → Auth routes: calls API
- Auth routes → Auth controller: delegates (evidence: `be/app/routes/auth.py`)
- Auth controller → Auth service: invokes (evidence: `be/app/controllers/auth.py`)
- Auth service → User records: queries users (evidence: `be/app/services/auth.py`)
- Auth service → JWT service: creates tokens (evidence: `be/app/services/auth.py`)
- Auth routes → Database sessions: gets session (evidence: `be/app/routes/auth.py`)
- Chat user → Chat panel: sends messages (evidence: `README.md`)
- Chat routes → Chat controller: delegates (evidence: `be/app/routes/chat.py`)
- Chat controller → Chat service: invokes
- Chat service → Chat records: uses records (evidence: `be/app/services/chat.py`)
- Chat service → Message records: uses records (evidence: `be/app/services/chat.py`)
- Chat service → Message service: uses service (evidence: `be/app/services/chat.py`)
- Chat service → Assistant service: uses service (evidence: `be/app/services/chat.py`)
- Chat service → AI service: requests AI (evidence: `be/app/services/chat.py`)
- Chat service → OpenAI provider: uses provider (evidence: `be/app/services/chat.py`)
- Chat routes → Database sessions: gets session (evidence: `be/app/routes/chat.py`)
- Chat service → Chat panel: streams response (evidence: `README.md`)
- Chat panel → Message renderer: renders markdown (evidence: `README.md`)
- Chat routes → JWT middleware: protected by (evidence: `be/app/main.py`)
- JWT middleware → JWT service: verifies token (evidence: `be/app/middleware/auth.py`)
- User routes → Chat controller: uses controller (evidence: `be/app/routes/user.py`)
- User routes → JWT middleware: protected by (evidence: `be/app/main.py`)
- Auth service → Redis cache: caches profile (evidence: `be/app/services/auth.py`)
- Redis cache → Cache adapter: constructs adapter (evidence: `be/app/core/cache.py`)
- Database sessions → User records: backs records (evidence: `be/app/database/models/user.py`)
- Database sessions → Message records: backs records (evidence: `be/app/database/models/message.py`)
