# sjana7797/solomon-ai architecture

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

- Interactive diagram: https://gitdiagram.com/sjana7797/solomon-ai
- Repository: https://github.com/sjana7797/solomon-ai

## Overview

Solomon is a web-based AI assistant with chat, research and document retrieval, memory, voice, image, finance, account, and encrypted-vault capabilities. A user composes a chat request in the web app; its stream manager calls the AI service, which generates and persists a response. Separate web features expose finance and discovery experiences. The README describes a generic Turborepo starter and does not document this product, so the map relies on the tree and sampled sources; unsampled subsystem links are omitted or marked unverified.

Main entry points: [`apps/web/src/features/chat/lib/stream-manager.ts`](https://github.com/sjana7797/solomon-ai/blob/main/apps/web/src/features/chat/lib/stream-manager.ts) (Chat streaming), [`apps/ai/app/api/v1/router.py`](https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/api/v1/router.py) (Versioned routes), [`apps/ai/app/api/v1/documents/router.py`](https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/api/v1/documents/router.py) (Document ingestion), [`apps/ai/app/api/v1/chat/repository.py`](https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/api/v1/chat/repository.py) (Chat persistence)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web app"]
  node_web_chat["Chat experience<br/>[chat-screen.tsx]"]
  node_stream["Chat streaming<br/>[stream-manager.ts]"]
  node_ai_client["AI client<br/>[ai-client.ts]"]
  node_chat_db[("Chat database<br/>[chat-db.ts]")]
  node_auth["Authentication<br/>[auth.ts]"]
  node_vault["Encrypted vault<br/>[router.ts]"]
  node_discover["News discovery<br/>[news.ts]"]
  node_web_finance["Finance views<br/>[finance-api.ts]"]
end

subgraph group_ai["AI service"]
  node_ai_entry["AI API entry<br/>[main.py]"]
  node_v1_routes["Versioned routes<br/>[router.py]"]
  node_ai_chat["Chat generation<br/>[services.py]"]
  node_research_rag["Research and RAG<br/>[rag_graph.py]"]
  node_documents["Document ingestion<br/>[router.py]"]
  node_memory["User memory<br/>[store.py]"]
  node_voice["Voice services<br/>[stt.py]"]
  node_identity["Request identity<br/>[identity.py]"]
  node_chat_repository["Chat persistence<br/>[repository.py]"]
end

subgraph group_finance["Finance API"]
  node_finance_api["Finance endpoints"]
  node_finance_service["Finance services<br/>[finance.service.ts]"]
  node_market_provider["Market data provider"]
end

subgraph group_data["Persistence and security"]
  node_crypto["Field encryption<br/>[crypto.py]"]
  node_ai_database[("AI database<br/>[session.py]")]
end

node_user(("User"))

node_user -->|"uses"| node_web_chat
node_web_chat -.->|"starts replies"| node_stream
node_stream -->|"opens stream"| node_ai_client
node_stream -->|"updates messages"| node_chat_db
node_ai_entry -.->|"mounts routes"| node_v1_routes
node_v1_routes -->|"registers router"| node_documents
node_v1_routes -->|"registers voice routes"| node_voice
node_ai_chat -->|"runs retrieval"| node_research_rag
node_ai_chat -.->|"saves exchange"| node_chat_repository
node_documents -->|"resolves owner"| node_identity
node_documents -->|"stores documents"| node_ai_database
node_chat_repository -->|"reads and writes"| node_ai_database
node_chat_repository -->|"encrypts content"| node_crypto
node_identity -->|"checks account"| node_ai_database
node_finance_api -->|"calls"| node_finance_service
node_finance_service -->|"requests market data"| node_market_provider
node_web_finance -.->|"requests quotes"| node_finance_api

click node_web_chat "https://github.com/sjana7797/solomon-ai/blob/main/apps/web/src/features/chat/components/chat-screen.tsx"
click node_stream "https://github.com/sjana7797/solomon-ai/blob/main/apps/web/src/features/chat/lib/stream-manager.ts"
click node_ai_client "https://github.com/sjana7797/solomon-ai/blob/main/apps/web/src/features/chat/api/ai-client.ts"
click node_chat_db "https://github.com/sjana7797/solomon-ai/blob/main/apps/web/src/features/chat/db/chat-db.ts"
click node_auth "https://github.com/sjana7797/solomon-ai/blob/main/apps/web/src/features/auth/server/auth.ts"
click node_vault "https://github.com/sjana7797/solomon-ai/blob/main/apps/web/src/features/vault/server/router.ts"
click node_discover "https://github.com/sjana7797/solomon-ai/blob/main/apps/web/src/features/discover/server/news.ts"
click node_web_finance "https://github.com/sjana7797/solomon-ai/blob/main/apps/web/src/features/finance/server/finance-api.ts"
click node_ai_entry "https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/main.py"
click node_v1_routes "https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/api/v1/router.py"
click node_ai_chat "https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/api/v1/ai/services.py"
click node_research_rag "https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/api/v1/ai/rag_graph.py"
click node_documents "https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/api/v1/documents/router.py"
click node_memory "https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/api/v1/memory/store.py"
click node_voice "https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/core/stt.py"
click node_identity "https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/api/identity.py"
click node_chat_repository "https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/api/v1/chat/repository.py"
click node_crypto "https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/core/crypto.py"
click node_ai_database "https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/core/db/session.py"
click node_finance_api "https://github.com/sjana7797/solomon-ai/blob/main/apps/api/src/modules/finance/finance.controller.ts"
click node_finance_service "https://github.com/sjana7797/solomon-ai/blob/main/apps/api/src/modules/finance/finance.service.ts"
click node_market_provider "https://github.com/sjana7797/solomon-ai/blob/main/apps/api/src/modules/finance/providers/market-data.provider.ts"

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_web_chat,node_stream,node_ai_client,node_chat_db,node_auth,node_vault,node_discover,node_web_finance,node_user toneBlue
class node_ai_entry,node_v1_routes,node_ai_chat,node_research_rag,node_documents,node_memory,node_voice,node_identity,node_chat_repository toneAmber
class node_finance_api,node_finance_service,node_market_provider toneMint
class node_crypto,node_ai_database toneRose
```

## Components

### Web app

- [Chat experience](https://github.com/sjana7797/solomon-ai/blob/main/apps/web/src/features/chat/components/chat-screen.tsx): `apps/web/src/features/chat/components/chat-screen.tsx`
- [Chat streaming](https://github.com/sjana7797/solomon-ai/blob/main/apps/web/src/features/chat/lib/stream-manager.ts): `apps/web/src/features/chat/lib/stream-manager.ts`
- [AI client](https://github.com/sjana7797/solomon-ai/blob/main/apps/web/src/features/chat/api/ai-client.ts): `apps/web/src/features/chat/api/ai-client.ts`
- [Chat database](https://github.com/sjana7797/solomon-ai/blob/main/apps/web/src/features/chat/db/chat-db.ts): `apps/web/src/features/chat/db/chat-db.ts`
- [Authentication](https://github.com/sjana7797/solomon-ai/blob/main/apps/web/src/features/auth/server/auth.ts): `apps/web/src/features/auth/server/auth.ts`
- [Encrypted vault](https://github.com/sjana7797/solomon-ai/blob/main/apps/web/src/features/vault/server/router.ts): `apps/web/src/features/vault/server/router.ts`
- [News discovery](https://github.com/sjana7797/solomon-ai/blob/main/apps/web/src/features/discover/server/news.ts): `apps/web/src/features/discover/server/news.ts`
- [Finance views](https://github.com/sjana7797/solomon-ai/blob/main/apps/web/src/features/finance/server/finance-api.ts): `apps/web/src/features/finance/server/finance-api.ts`

### AI service

- [AI API entry](https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/main.py): `apps/ai/main.py`
- [Versioned routes](https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/api/v1/router.py): `apps/ai/app/api/v1/router.py`
- [Chat generation](https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/api/v1/ai/services.py): `apps/ai/app/api/v1/ai/services.py`
- [Research and RAG](https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/api/v1/ai/rag_graph.py): `apps/ai/app/api/v1/ai/rag_graph.py`
- [Document ingestion](https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/api/v1/documents/router.py): `apps/ai/app/api/v1/documents/router.py`
- [User memory](https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/api/v1/memory/store.py): `apps/ai/app/api/v1/memory/store.py`
- [Voice services](https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/core/stt.py): `apps/ai/app/core/stt.py`
- [Request identity](https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/api/identity.py): `apps/ai/app/api/identity.py`
- [Chat persistence](https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/api/v1/chat/repository.py): `apps/ai/app/api/v1/chat/repository.py`

### Finance API

- [Finance endpoints](https://github.com/sjana7797/solomon-ai/blob/main/apps/api/src/modules/finance/finance.controller.ts): `apps/api/src/modules/finance/finance.controller.ts`
- [Finance services](https://github.com/sjana7797/solomon-ai/blob/main/apps/api/src/modules/finance/finance.service.ts): `apps/api/src/modules/finance/finance.service.ts`
- [Market data provider](https://github.com/sjana7797/solomon-ai/blob/main/apps/api/src/modules/finance/providers/market-data.provider.ts): `apps/api/src/modules/finance/providers/market-data.provider.ts`

### Persistence and security

- [Field encryption](https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/core/crypto.py): `apps/ai/app/core/crypto.py`
- [AI database](https://github.com/sjana7797/solomon-ai/blob/main/apps/ai/app/core/db/session.py): `apps/ai/app/core/db/session.py`

### Other components

- **User**

## Connections

- User → Chat experience: uses
- Chat experience → Chat streaming: starts replies
- Chat streaming → AI client: opens stream (evidence: `apps/web/src/features/chat/lib/stream-manager.ts`)
- Chat streaming → Chat database: updates messages (evidence: `apps/web/src/features/chat/lib/stream-manager.ts`)
- AI API entry → Versioned routes: mounts routes
- Versioned routes → Document ingestion: registers router (evidence: `apps/ai/app/api/v1/router.py`)
- Versioned routes → Voice services: registers voice routes (evidence: `apps/ai/app/api/v1/router.py`)
- Chat generation → Research and RAG: runs retrieval (evidence: `apps/ai/app/api/v1/ai/services.py`)
- Chat generation → Chat persistence: saves exchange (evidence: `apps/ai/app/api/v1/ai/services.py`)
- Document ingestion → Request identity: resolves owner (evidence: `apps/ai/app/api/v1/documents/router.py`)
- Document ingestion → AI database: stores documents
- Chat persistence → AI database: reads and writes (evidence: `apps/ai/app/api/v1/chat/repository.py`)
- Chat persistence → Field encryption: encrypts content (evidence: `apps/ai/app/api/v1/chat/repository.py`)
- Request identity → AI database: checks account (evidence: `apps/ai/app/api/identity.py`)
- Finance endpoints → Finance services: calls (evidence: `apps/api/src/modules/finance/finance.controller.ts`)
- Finance services → Market data provider: requests market data (evidence: `apps/api/src/modules/finance/finance.service.ts`)
- Finance views → Finance endpoints: requests quotes
