# sky-254-1/nebula-search- architecture

> Architecture diagram of the GitHub repository sky-254-1/nebula-search-, 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/sky-254-1/nebula-search-
- Repository: https://github.com/sky-254-1/nebula-search-

## Overview

Nebula is a privacy-oriented hybrid search platform with a React web app, FastAPI backend, and mobile shells. The main workflow is a user submitting a query through the app to backend search, where query understanding and hybrid retrieval produce results; document ingestion and crawling supply searchable content, and AI can generate cited answers. Other documented capabilities include authentication, analytics, offline search, and mobile access. Several subsystem links below are based on README descriptions because their implementation files were not sampled; the graph does not imply unshown call-level wiring.

Main entry points: [`backend/app/search/search_service.py`](https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/search/search_service.py) (Search orchestration), [`backend/vector/pipeline/__init__.py`](https://github.com/sky-254-1/nebula-search-/blob/main/backend/vector/pipeline/__init__.py) (Document indexing), [`backend/app/database/engine.py`](https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/database/engine.py) (Application database), [`backend/app/routes/storage.py`](https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/routes/storage.py) (Document management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User clients"]
  node_web["Web application<br/>[App.tsx]"]
  node_mobile["Mobile clients<br/>[app.ts]"]
  node_offline["Offline search<br/>[sw.js]"]
end

subgraph group_api["API and identity"]
  node_api_server["Backend API<br/>[main.py]"]
  node_auth["Authentication and RBAC<br/>[auth.py]"]
  node_search_routes["Search endpoints<br/>[search.py]"]
end

subgraph group_search["Search and discovery"]
  node_query["Query understanding<br/>[pipeline.py]"]
  node_search_service["Search orchestration<br/>[search_service.py]"]
  node_hybrid["Hybrid retrieval"]
  node_semantic["Semantic search<br/>[engine.py]"]
end

subgraph group_content["Content and indexing"]
  node_documents["Document management<br/>[storage.py]"]
  node_crawler["Web crawler<br/>[crawler.py]"]
  node_indexing["Document indexing<br/>[__init__.py]"]
  node_incremental["Incremental reindexing"]
end

subgraph group_platform["Data and intelligence"]
  node_database[("Application database<br/>[engine.py]")]
  node_vector_store[("Vector stores")]
  node_ai["AI answer service<br/>[ai.py]"]
  node_analytics["Analytics"]
end

node_user(("User"))
node_llm{{"AI providers"}}

node_user -->|"uses"| node_web
node_web -->|"calls API"| node_api_server
node_user -->|"uses"| node_mobile
node_mobile -.->|"accesses"| node_api_server
node_api_server -->|"serves"| node_search_routes
node_search_routes -.->|"dispatches"| node_search_service
node_search_service -->|"processes query"| node_query
node_search_service -.->|"retrieves results"| node_hybrid
node_search_service -.->|"uses semantic search"| node_semantic
node_user -->|"manages documents"| node_documents
node_documents -->|"reads and writes"| node_database
node_user -->|"starts crawl"| node_crawler
node_crawler -.->|"supplies content"| node_indexing
node_documents -.->|"indexes uploads"| node_indexing
node_indexing -->|"stores metadata"| node_database
node_indexing -.->|"stores vectors"| node_vector_store
node_incremental -.->|"reindexes documents"| node_indexing
node_search_service -.->|"records searches"| node_database
node_search_service -.->|"provides context"| node_ai
node_ai -.->|"requests answers"| node_llm
node_user -->|"views insights"| node_analytics
node_analytics -.->|"records behavior"| node_database
node_user -->|"searches offline"| node_offline

click node_web "https://github.com/sky-254-1/nebula-search-/blob/main/frontend/src/App.tsx"
click node_mobile "https://github.com/sky-254-1/nebula-search-/blob/main/mobile/src/app.ts"
click node_api_server "https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/main.py"
click node_auth "https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/services/auth.py"
click node_search_routes "https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/routes/search.py"
click node_query "https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/search/query_understanding/pipeline.py"
click node_search_service "https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/search/search_service.py"
click node_hybrid "https://github.com/sky-254-1/nebula-search-/tree/main/backend/app/hybrid"
click node_semantic "https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/search/semantic/engine.py"
click node_documents "https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/routes/storage.py"
click node_crawler "https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/crawler/crawler.py"
click node_indexing "https://github.com/sky-254-1/nebula-search-/blob/main/backend/vector/pipeline/__init__.py"
click node_incremental "https://github.com/sky-254-1/nebula-search-/tree/main/backend/app/incremental"
click node_database "https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/database/engine.py"
click node_vector_store "https://github.com/sky-254-1/nebula-search-/tree/main/backend/app/search/semantic/vector_store"
click node_ai "https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/services/ai.py"
click node_analytics "https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/services/analytics_service.py"
click node_offline "https://github.com/sky-254-1/nebula-search-/blob/main/frontend/public/sw.js"

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,node_mobile,node_offline,node_user toneBlue
class node_api_server,node_auth,node_search_routes toneAmber
class node_query,node_search_service,node_hybrid,node_semantic toneMint
class node_documents,node_crawler,node_indexing,node_incremental toneRose
class node_database,node_vector_store,node_ai,node_analytics,node_llm toneIndigo
```

## Components

### User clients

- [Web application](https://github.com/sky-254-1/nebula-search-/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Mobile clients](https://github.com/sky-254-1/nebula-search-/blob/main/mobile/src/app.ts): `mobile/src/app.ts`
- [Offline search](https://github.com/sky-254-1/nebula-search-/blob/main/frontend/public/sw.js): `frontend/public/sw.js`

### API and identity

- [Backend API](https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication and RBAC](https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/services/auth.py): `backend/app/services/auth.py`
- [Search endpoints](https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/routes/search.py): `backend/app/routes/search.py`

### Search and discovery

- [Query understanding](https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/search/query_understanding/pipeline.py): `backend/app/search/query_understanding/pipeline.py`
- [Search orchestration](https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/search/search_service.py): `backend/app/search/search_service.py`
- [Hybrid retrieval](https://github.com/sky-254-1/nebula-search-/tree/main/backend/app/hybrid): `backend/app/hybrid`
- [Semantic search](https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/search/semantic/engine.py): `backend/app/search/semantic/engine.py`

### Content and indexing

- [Document management](https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/routes/storage.py): `backend/app/routes/storage.py`
- [Web crawler](https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/crawler/crawler.py): `backend/app/crawler/crawler.py`
- [Document indexing](https://github.com/sky-254-1/nebula-search-/blob/main/backend/vector/pipeline/__init__.py): `backend/vector/pipeline/__init__.py`
- [Incremental reindexing](https://github.com/sky-254-1/nebula-search-/tree/main/backend/app/incremental): `backend/app/incremental`

### Data and intelligence

- [Application database](https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/database/engine.py): `backend/app/database/engine.py`
- [Vector stores](https://github.com/sky-254-1/nebula-search-/tree/main/backend/app/search/semantic/vector_store): `backend/app/search/semantic/vector_store`
- [AI answer service](https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/services/ai.py): `backend/app/services/ai.py`
- [Analytics](https://github.com/sky-254-1/nebula-search-/blob/main/backend/app/services/analytics_service.py): `backend/app/services/analytics_service.py`

### Other components

- **User**
- **AI providers**

## Connections

- User → Web application: uses (evidence: `README.md`)
- Web application → Backend API: calls API (evidence: `README.md`)
- User → Mobile clients: uses (evidence: `README.md`)
- Mobile clients → Backend API: accesses (evidence: `README.md`)
- Backend API → Search endpoints: serves (evidence: `backend/app/main.py`)
- Search endpoints → Search orchestration: dispatches
- Search orchestration → Query understanding: processes query (evidence: `backend/app/search/search_service.py`)
- Search orchestration → Hybrid retrieval: retrieves results (evidence: `README.md`)
- Search orchestration → Semantic search: uses semantic search (evidence: `README.md`)
- User → Document management: manages documents (evidence: `README.md`)
- Document management → Application database: reads and writes (evidence: `backend/app/routes/storage.py`)
- User → Web crawler: starts crawl (evidence: `README.md`)
- Web crawler → Document indexing: supplies content (evidence: `README.md`)
- Document management → Document indexing: indexes uploads (evidence: `README.md`)
- Document indexing → Application database: stores metadata (evidence: `backend/vector/pipeline/__init__.py`)
- Document indexing → Vector stores: stores vectors (evidence: `README.md`)
- Incremental reindexing → Document indexing: reindexes documents
- Search orchestration → Application database: records searches (evidence: `README.md`)
- Search orchestration → AI answer service: provides context (evidence: `README.md`)
- AI answer service → AI providers: requests answers (evidence: `README.md`)
- User → Analytics: views insights (evidence: `README.md`)
- Analytics → Application database: records behavior (evidence: `README.md`)
- User → Offline search: searches offline (evidence: `README.md`)
