# codenama-007/app-saturation-radar architecture

> Architecture diagram of the GitHub repository codenama-007/app-saturation-radar, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/codenama-007/app-saturation-radar
- Repository: https://github.com/codenama-007/app-saturation-radar

## Overview

App Saturation Radar lets users submit an app idea and receive a market verdict, competitor analysis, scores, gaps, and differentiators. The authenticated chat UI reaches a FastAPI service, which runs a cache-aware research and analysis graph; results can be streamed and saved as chat history. The README describes Product Hunt search, but the sampled graph code disables it and currently searches the web. Several frontend and search details are unsampled, so their connections are omitted or marked unverified.

Main entry points: [`ml_service/graph.py`](https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/graph.py) (Analysis workflow), [`ml_service/main.py`](https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/main.py) (Radar API), [`ml_service/chats.py`](https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/chats.py) (Chat history routes), [`ml_service/models.py`](https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/models.py) (User and chat records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["User experience"]
  node_main_ui["Analysis chat screen<br/>[page.tsx]"]
  node_chat_ui["Chat interaction<br/>[ChatComponent.tsx]"]
  node_auth_guard["Auth guard<br/>[AuthGuard.tsx]"]
  node_auth_storage[("Browser session<br/>[token.ts]")]
end

subgraph group_service["API and identity"]
  node_api["Radar API<br/>[main.py]"]
  node_identity["Authentication<br/>[security.py]"]
  node_schemas["Request and response schemas<br/>[schemas.py]"]
  node_streaming["Streaming responses<br/>[streaming.py]"]
end

subgraph group_analysis["Market analysis"]
  node_analysis_graph["Analysis workflow<br/>[graph.py]"]
  node_query_gen["Query generation<br/>[graph.py]"]
  node_web_search["Web research<br/>[tools.py]"]
  node_product_hunt["Product Hunt search"]
  node_competitor_review["Competitor classification<br/>[graph.py]"]
  node_market_scores["Market scoring<br/>[scoring.py]"]
  node_gap_suggestions["Gaps and differentiators<br/>[graph.py]"]
end

subgraph group_state["Persistence"]
  node_cache[("Idea result cache<br/>[memory.py]")]
  node_chat_history["Chat history routes<br/>[chats.py]"]
  node_relational_store[("Relational database<br/>[database.py]")]
  node_data_models["User and chat records<br/>[models.py]"]
end

node_user(("Idea submitter"))
node_llm(("Local Ollama model"))

node_user -->|"submits idea"| node_main_ui
node_main_ui -->|"wraps screen"| node_auth_guard
node_main_ui -->|"renders"| node_chat_ui
node_chat_ui -.->|"requests analysis"| node_api
node_auth_guard -.->|"checks session"| node_auth_storage
node_chat_ui -.->|"uses session"| node_auth_storage
node_api -->|"validates requests"| node_schemas
node_api -->|"authenticates routes"| node_identity
node_api -->|"invokes analysis"| node_analysis_graph
node_api -->|"streams analysis"| node_streaming
node_api -->|"checks chat ownership"| node_chat_history
node_analysis_graph -->|"checks and saves results"| node_cache
node_analysis_graph -->|"dispatches"| node_query_gen
node_query_gen -->|"generates query"| node_llm
node_analysis_graph -->|"searches web"| node_web_search
node_analysis_graph -.->|"searches products"| node_product_hunt
node_analysis_graph -->|"classifies results"| node_competitor_review
node_competitor_review -->|"analyzes competitors"| node_llm
node_analysis_graph -->|"calculates scores"| node_market_scores
node_analysis_graph -->|"generates gaps"| node_gap_suggestions
node_gap_suggestions -->|"suggests differentiators"| node_llm
node_streaming -->|"streams graph events"| node_analysis_graph
node_streaming -->|"saves completed turn"| node_chat_history
node_chat_history -->|"reads and writes"| node_relational_store
node_api -->|"creates tables"| node_relational_store
node_api -->|"queries users"| node_data_models
node_chat_history -->|"queries chat records"| node_data_models
node_identity -->|"loads user"| node_data_models
node_data_models -->|"maps records"| node_relational_store

click node_main_ui "https://github.com/codenama-007/app-saturation-radar/blob/main/full-stack-app/app/main/page.tsx"
click node_chat_ui "https://github.com/codenama-007/app-saturation-radar/blob/main/full-stack-app/components/ChatComponent.tsx"
click node_auth_guard "https://github.com/codenama-007/app-saturation-radar/blob/main/full-stack-app/components/AuthGuard.tsx"
click node_auth_storage "https://github.com/codenama-007/app-saturation-radar/blob/main/full-stack-app/lib/token.ts"
click node_api "https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/main.py"
click node_identity "https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/security.py"
click node_schemas "https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/schemas.py"
click node_analysis_graph "https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/graph.py"
click node_query_gen "https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/graph.py"
click node_web_search "https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/tools.py"
click node_competitor_review "https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/graph.py"
click node_market_scores "https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/scoring.py"
click node_gap_suggestions "https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/graph.py"
click node_cache "https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/memory.py"
click node_streaming "https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/streaming.py"
click node_chat_history "https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/chats.py"
click node_relational_store "https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/database.py"
click node_data_models "https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/models.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_main_ui,node_chat_ui,node_auth_guard,node_auth_storage toneBlue
class node_api,node_identity,node_schemas,node_streaming toneAmber
class node_analysis_graph,node_query_gen,node_web_search,node_product_hunt,node_competitor_review,node_market_scores,node_gap_suggestions toneMint
class node_cache,node_chat_history,node_relational_store,node_data_models toneRose
class node_user,node_llm toneIndigo
```

## Components

### User experience

- [Analysis chat screen](https://github.com/codenama-007/app-saturation-radar/blob/main/full-stack-app/app/main/page.tsx): `full-stack-app/app/main/page.tsx`
- [Chat interaction](https://github.com/codenama-007/app-saturation-radar/blob/main/full-stack-app/components/ChatComponent.tsx): `full-stack-app/components/ChatComponent.tsx`
- [Auth guard](https://github.com/codenama-007/app-saturation-radar/blob/main/full-stack-app/components/AuthGuard.tsx): `full-stack-app/components/AuthGuard.tsx`
- [Browser session](https://github.com/codenama-007/app-saturation-radar/blob/main/full-stack-app/lib/token.ts): `full-stack-app/lib/token.ts`

### API and identity

- [Radar API](https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/main.py): `ml_service/main.py`
- [Authentication](https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/security.py): `ml_service/security.py`
- [Request and response schemas](https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/schemas.py): `ml_service/schemas.py`
- [Streaming responses](https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/streaming.py): `ml_service/streaming.py`

### Market analysis

- [Analysis workflow](https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/graph.py): `ml_service/graph.py`
- [Query generation](https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/graph.py): `ml_service/graph.py`
- [Web research](https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/tools.py): `ml_service/tools.py`
- **Product Hunt search**
- [Competitor classification](https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/graph.py): `ml_service/graph.py`
- [Market scoring](https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/scoring.py): `ml_service/scoring.py`
- [Gaps and differentiators](https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/graph.py): `ml_service/graph.py`

### Persistence

- [Idea result cache](https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/memory.py): `ml_service/memory.py`
- [Chat history routes](https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/chats.py): `ml_service/chats.py`
- [Relational database](https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/database.py): `ml_service/database.py`
- [User and chat records](https://github.com/codenama-007/app-saturation-radar/blob/main/ml_service/models.py): `ml_service/models.py`

### Other components

- **Idea submitter**
- **Local Ollama model**

## Connections

- Idea submitter → Analysis chat screen: submits idea (evidence: `README.md`)
- Analysis chat screen → Auth guard: wraps screen (evidence: `full-stack-app/app/main/page.tsx`)
- Analysis chat screen → Chat interaction: renders (evidence: `full-stack-app/app/main/page.tsx`)
- Chat interaction → Radar API: requests analysis
- Auth guard → Browser session: checks session
- Chat interaction → Browser session: uses session
- Radar API → Request and response schemas: validates requests (evidence: `ml_service/main.py`)
- Radar API → Authentication: authenticates routes (evidence: `ml_service/main.py`)
- Radar API → Analysis workflow: invokes analysis (evidence: `ml_service/main.py`)
- Radar API → Streaming responses: streams analysis (evidence: `ml_service/main.py`)
- Radar API → Chat history routes: checks chat ownership (evidence: `ml_service/main.py`)
- Analysis workflow → Idea result cache: checks and saves results (evidence: `ml_service/graph.py`)
- Analysis workflow → Query generation: dispatches (evidence: `ml_service/graph.py`)
- Query generation → Local Ollama model: generates query (evidence: `ml_service/graph.py`)
- Analysis workflow → Web research: searches web (evidence: `ml_service/graph.py`)
- Analysis workflow → Product Hunt search: searches products (evidence: `README.md`)
- Analysis workflow → Competitor classification: classifies results (evidence: `ml_service/graph.py`)
- Competitor classification → Local Ollama model: analyzes competitors (evidence: `ml_service/graph.py`)
- Analysis workflow → Market scoring: calculates scores (evidence: `ml_service/graph.py`)
- Analysis workflow → Gaps and differentiators: generates gaps (evidence: `ml_service/graph.py`)
- Gaps and differentiators → Local Ollama model: suggests differentiators (evidence: `ml_service/graph.py`)
- Streaming responses → Analysis workflow: streams graph events (evidence: `ml_service/streaming.py`)
- Streaming responses → Chat history routes: saves completed turn (evidence: `ml_service/streaming.py`)
- Chat history routes → Relational database: reads and writes (evidence: `ml_service/chats.py`)
- Radar API → Relational database: creates tables (evidence: `ml_service/main.py`)
- Radar API → User and chat records: queries users (evidence: `ml_service/main.py`)
- Chat history routes → User and chat records: queries chat records (evidence: `ml_service/chats.py`)
- Authentication → User and chat records: loads user (evidence: `ml_service/security.py`)
- User and chat records → Relational database: maps records (evidence: `ml_service/models.py`)
