# vivek5143/atlasai architecture

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

- Interactive diagram: https://gitdiagram.com/vivek5143/atlasai
- Repository: https://github.com/vivek5143/atlasai

## Overview

AtlasAI is a market-intelligence platform: users browse company, sector, problem, and news data, or ask questions through a grounded RAG interface. Its backend combines FastAPI services, PostgreSQL-backed records, ChromaDB retrieval, and Gemini answer generation; admins can discover and review candidate companies before they enter trusted data. The graph preserves the README’s major capabilities. Some subsystem links rely on README documentation because their implementation files were not sampled.

Main entry points: [`backend/app/services/company_discovery_service.py`](https://github.com/vivek5143/atlasai/blob/main/backend/app/services/company_discovery_service.py) (Candidate workflow), [`backend/app/api/router.py`](https://github.com/vivek5143/atlasai/blob/main/backend/app/api/router.py) (REST API router), [`backend/app/services/ask_agent_service.py`](https://github.com/vivek5143/atlasai/blob/main/backend/app/services/ask_agent_service.py) (Ask agent service), [`backend/app/ai/ingest.py`](https://github.com/vivek5143/atlasai/blob/main/backend/app/ai/ingest.py) (Document ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User interface"]
  node_webapp["AtlasAI web app<br/>[App.tsx]"]
  node_market_pages["Market pages"]
  node_ask_page["Ask AI page<br/>[AskAtlasAI.tsx]"]
  node_discovery_page["Discovery review"]
  node_api_client["Frontend API client<br/>[client.ts]"]
end

subgraph group_api["API and services"]
  node_api_router["REST API router<br/>[router.py]"]
  node_market_endpoints["Market endpoints"]
  node_ask_endpoint["Ask endpoint<br/>[ask.py]"]
  node_discovery_endpoint["Discovery endpoint<br/>[discovery.py]"]
  node_market_services["Market services"]
  node_ask_service["Ask agent service"]
  node_news_service["News browsing<br/>[news_service.py]"]
end

subgraph group_intelligence["Market intelligence"]
  node_discovery_service["Candidate workflow"]
  node_news_sync["News synchronization"]
  node_news_api["NewsAPI provider<br/>[news_api_client.py]"]
  node_tavily["Tavily discovery<br/>[tavily_provider.py]"]
end

subgraph group_knowledge["Knowledge and RAG"]
  node_ingestion["Document ingestion<br/>[ingest.py]"]
  node_retriever["Semantic retrieval<br/>[retriever.py]"]
  node_vector_store[("Vector store<br/>[vector_store.py]")]
  node_chat["Answer generation<br/>[chat.py]"]
end

subgraph group_persistence["Data stores"]
  node_postgres[("Structured records<br/>[company.py]")]
  node_candidate_records[("Discovery candidates")]
  node_news_records[("News records<br/>[news_article.py]")]
end

node_user(("Platform user"))
node_admin(("Admin reviewer"))
node_gemini{{"Gemini service"}}
node_newsapi_external{{"NewsAPI"}}
node_tavily_external{{"Tavily API"}}

node_user -->|"uses"| node_webapp
node_admin -->|"reviews candidates"| node_discovery_page
node_webapp -.->|"renders"| node_market_pages
node_market_pages -.->|"requests data"| node_api_client
node_ask_page -.->|"submits question"| node_api_client
node_discovery_page -.->|"manages review"| node_api_client
node_api_client -.->|"calls API"| node_api_router
node_api_router -->|"registers routes"| node_market_endpoints
node_api_router -->|"registers route"| node_ask_endpoint
node_api_router -->|"registers route"| node_discovery_endpoint
node_market_endpoints -.->|"serves requests"| node_market_services
node_ask_endpoint -->|"delegates"| node_ask_service
node_ask_service -.->|"retrieves context"| node_retriever
node_retriever -->|"searches vectors"| node_vector_store
node_ask_service -.->|"generates answer"| node_chat
node_chat -->|"generates response"| node_gemini
node_discovery_endpoint -.->|"delegates"| node_discovery_service
node_discovery_service -->|"discovers organizations"| node_tavily
node_tavily -->|"searches"| node_tavily_external
node_discovery_service -->|"stores candidates"| node_candidate_records
node_discovery_service -->|"approves trusted company"| node_postgres
node_discovery_service -->|"indexes approved company"| node_ingestion
node_news_sync -->|"fetches articles"| node_news_api
node_news_api -->|"queries"| node_newsapi_external
node_news_sync -->|"persists articles"| node_news_records
node_news_sync -->|"indexes news"| node_ingestion
node_news_service -.->|"reads articles"| node_news_records
node_ingestion -->|"reads records"| node_postgres
node_ingestion -->|"indexes chunks"| node_vector_store
node_retriever -->|"resolves company context"| node_postgres
node_ask_service -.->|"returns sources"| node_vector_store

click node_webapp "https://github.com/vivek5143/atlasai/blob/main/frontend/src/App.tsx"
click node_market_pages "https://github.com/vivek5143/atlasai/tree/main/frontend/src/pages"
click node_ask_page "https://github.com/vivek5143/atlasai/blob/main/frontend/src/pages/AskAtlasAI.tsx"
click node_discovery_page "https://github.com/vivek5143/atlasai/blob/main/frontend/src/pages/company-discovery-page.tsx"
click node_api_client "https://github.com/vivek5143/atlasai/blob/main/frontend/src/services/api/client.ts"
click node_api_router "https://github.com/vivek5143/atlasai/blob/main/backend/app/api/router.py"
click node_market_endpoints "https://github.com/vivek5143/atlasai/tree/main/backend/app/api/v1/endpoints"
click node_ask_endpoint "https://github.com/vivek5143/atlasai/blob/main/backend/app/api/v1/endpoints/ask.py"
click node_discovery_endpoint "https://github.com/vivek5143/atlasai/blob/main/backend/app/api/v1/endpoints/discovery.py"
click node_market_services "https://github.com/vivek5143/atlasai/tree/main/backend/app/services"
click node_ask_service "https://github.com/vivek5143/atlasai/blob/main/backend/app/services/ask_agent_service.py"
click node_discovery_service "https://github.com/vivek5143/atlasai/blob/main/backend/app/services/company_discovery_service.py"
click node_news_sync "https://github.com/vivek5143/atlasai/blob/main/backend/app/services/news_sync_service.py"
click node_news_api "https://github.com/vivek5143/atlasai/blob/main/backend/app/clients/news_api_client.py"
click node_tavily "https://github.com/vivek5143/atlasai/blob/main/backend/app/discovery/tavily_provider.py"
click node_ingestion "https://github.com/vivek5143/atlasai/blob/main/backend/app/ai/ingest.py"
click node_retriever "https://github.com/vivek5143/atlasai/blob/main/backend/app/ai/retriever.py"
click node_vector_store "https://github.com/vivek5143/atlasai/blob/main/backend/app/ai/vector_store.py"
click node_chat "https://github.com/vivek5143/atlasai/blob/main/backend/app/ai/chat.py"
click node_postgres "https://github.com/vivek5143/atlasai/blob/main/backend/app/models/company.py"
click node_candidate_records "https://github.com/vivek5143/atlasai/blob/main/backend/app/models/company_discovery_candidate.py"
click node_news_records "https://github.com/vivek5143/atlasai/blob/main/backend/app/models/news_article.py"
click node_news_service "https://github.com/vivek5143/atlasai/blob/main/backend/app/services/news_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_webapp,node_market_pages,node_ask_page,node_discovery_page,node_api_client,node_user,node_admin toneBlue
class node_api_router,node_market_endpoints,node_ask_endpoint,node_discovery_endpoint,node_market_services,node_ask_service,node_news_service toneAmber
class node_discovery_service,node_news_sync,node_news_api,node_tavily,node_newsapi_external,node_tavily_external toneMint
class node_ingestion,node_retriever,node_vector_store,node_chat toneRose
class node_postgres,node_candidate_records,node_news_records,node_gemini toneIndigo
```

## Components

### User interface

- [AtlasAI web app](https://github.com/vivek5143/atlasai/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Market pages](https://github.com/vivek5143/atlasai/tree/main/frontend/src/pages): `frontend/src/pages`
- [Ask AI page](https://github.com/vivek5143/atlasai/blob/main/frontend/src/pages/AskAtlasAI.tsx): `frontend/src/pages/AskAtlasAI.tsx`
- [Discovery review](https://github.com/vivek5143/atlasai/blob/main/frontend/src/pages/company-discovery-page.tsx): `frontend/src/pages/company-discovery-page.tsx`
- [Frontend API client](https://github.com/vivek5143/atlasai/blob/main/frontend/src/services/api/client.ts): `frontend/src/services/api/client.ts`

### API and services

- [REST API router](https://github.com/vivek5143/atlasai/blob/main/backend/app/api/router.py): `backend/app/api/router.py`
- [Market endpoints](https://github.com/vivek5143/atlasai/tree/main/backend/app/api/v1/endpoints): `backend/app/api/v1/endpoints`
- [Ask endpoint](https://github.com/vivek5143/atlasai/blob/main/backend/app/api/v1/endpoints/ask.py): `backend/app/api/v1/endpoints/ask.py`
- [Discovery endpoint](https://github.com/vivek5143/atlasai/blob/main/backend/app/api/v1/endpoints/discovery.py): `backend/app/api/v1/endpoints/discovery.py`
- [Market services](https://github.com/vivek5143/atlasai/tree/main/backend/app/services): `backend/app/services`
- [Ask agent service](https://github.com/vivek5143/atlasai/blob/main/backend/app/services/ask_agent_service.py): `backend/app/services/ask_agent_service.py`
- [News browsing](https://github.com/vivek5143/atlasai/blob/main/backend/app/services/news_service.py): `backend/app/services/news_service.py`

### Market intelligence

- [Candidate workflow](https://github.com/vivek5143/atlasai/blob/main/backend/app/services/company_discovery_service.py): `backend/app/services/company_discovery_service.py`
- [News synchronization](https://github.com/vivek5143/atlasai/blob/main/backend/app/services/news_sync_service.py): `backend/app/services/news_sync_service.py`
- [NewsAPI provider](https://github.com/vivek5143/atlasai/blob/main/backend/app/clients/news_api_client.py): `backend/app/clients/news_api_client.py`
- [Tavily discovery](https://github.com/vivek5143/atlasai/blob/main/backend/app/discovery/tavily_provider.py): `backend/app/discovery/tavily_provider.py`

### Knowledge and RAG

- [Document ingestion](https://github.com/vivek5143/atlasai/blob/main/backend/app/ai/ingest.py): `backend/app/ai/ingest.py`
- [Semantic retrieval](https://github.com/vivek5143/atlasai/blob/main/backend/app/ai/retriever.py): `backend/app/ai/retriever.py`
- [Vector store](https://github.com/vivek5143/atlasai/blob/main/backend/app/ai/vector_store.py): `backend/app/ai/vector_store.py`
- [Answer generation](https://github.com/vivek5143/atlasai/blob/main/backend/app/ai/chat.py): `backend/app/ai/chat.py`

### Data stores

- [Structured records](https://github.com/vivek5143/atlasai/blob/main/backend/app/models/company.py): `backend/app/models/company.py`
- [Discovery candidates](https://github.com/vivek5143/atlasai/blob/main/backend/app/models/company_discovery_candidate.py): `backend/app/models/company_discovery_candidate.py`
- [News records](https://github.com/vivek5143/atlasai/blob/main/backend/app/models/news_article.py): `backend/app/models/news_article.py`

### Other components

- **Platform user**
- **Admin reviewer**
- **Gemini service**
- **NewsAPI**
- **Tavily API**

## Connections

- Platform user → AtlasAI web app: uses (evidence: `README.md`)
- Admin reviewer → Discovery review: reviews candidates (evidence: `README.md`)
- AtlasAI web app → Market pages: renders
- Market pages → Frontend API client: requests data
- Ask AI page → Frontend API client: submits question
- Discovery review → Frontend API client: manages review
- Frontend API client → REST API router: calls API
- REST API router → Market endpoints: registers routes (evidence: `backend/app/api/router.py`)
- REST API router → Ask endpoint: registers route (evidence: `backend/app/api/router.py`)
- REST API router → Discovery endpoint: registers route (evidence: `backend/app/api/router.py`)
- Market endpoints → Market services: serves requests (evidence: `backend/app/api/v1/endpoints/auth.py`)
- Ask endpoint → Ask agent service: delegates (evidence: `backend/app/api/v1/endpoints/ask.py`)
- Ask agent service → Semantic retrieval: retrieves context
- Semantic retrieval → Vector store: searches vectors (evidence: `backend/app/ai/retriever.py`)
- Ask agent service → Answer generation: generates answer
- Answer generation → Gemini service: generates response (evidence: `README.md`)
- Discovery endpoint → Candidate workflow: delegates
- Candidate workflow → Tavily discovery: discovers organizations (evidence: `backend/app/services/company_discovery_service.py`)
- Tavily discovery → Tavily API: searches (evidence: `README.md`)
- Candidate workflow → Discovery candidates: stores candidates (evidence: `README.md`)
- Candidate workflow → Structured records: approves trusted company (evidence: `README.md`)
- Candidate workflow → Document ingestion: indexes approved company (evidence: `README.md`)
- News synchronization → NewsAPI provider: fetches articles (evidence: `backend/app/services/news_sync_service.py`)
- NewsAPI provider → NewsAPI: queries (evidence: `README.md`)
- News synchronization → News records: persists articles (evidence: `backend/app/services/news_sync_service.py`)
- News synchronization → Document ingestion: indexes news (evidence: `README.md`)
- News browsing → News records: reads articles
- Document ingestion → Structured records: reads records (evidence: `backend/app/ai/ingest.py`)
- Document ingestion → Vector store: indexes chunks (evidence: `README.md`)
- Semantic retrieval → Structured records: resolves company context (evidence: `backend/app/ai/retriever.py`)
- Ask agent service → Vector store: returns sources
