# shiza176/leadpilott architecture

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

- Interactive diagram: https://gitdiagram.com/shiza176/leadpilott
- Repository: https://github.com/shiza176/leadpilott

## Overview

LeadPilot is a lead-discovery application: users search for companies and decision-makers, review results, and can manage saved items and search history. The frontend also exposes account, settings, statistics, and AI-assistance features. The sampled search engine excerpt generates a placeholder company result, so the graph does not assume a live lead-data source or a complete search pipeline. Several route and page implementations were not sampled; their presence is represented without asserting uncertain internal wiring.

Main entry points: [`frontend/src/App.tsx`](https://github.com/shiza176/leadpilott/blob/main/frontend/src/App.tsx) (Web application), [`backend/src/routes/index.ts`](https://github.com/shiza176/leadpilott/blob/main/backend/src/routes/index.ts) (API route registry), [`frontend/src/api/client.ts`](https://github.com/shiza176/leadpilott/blob/main/frontend/src/api/client.ts) (API client), [`frontend/src/pages/Discovery.tsx`](https://github.com/shiza176/leadpilott/blob/main/frontend/src/pages/Discovery.tsx) (Discovery search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Frontend experience"]
  node_frontend["Web application<br/>[App.tsx]"]
  node_discovery["Discovery search<br/>[Discovery.tsx]"]
  node_searchbar["Search controls<br/>[SearchBar.tsx]"]
  node_searchengine["Search interpretation<br/>[search-engine.ts]"]
  node_assistant["AI assistant"]
  node_savedpage["Saved items<br/>[Saved.tsx]"]
  node_historypage["Search history<br/>[SearchHistory.tsx]"]
  node_api["API client<br/>[client.ts]"]
  node_aiapi["AI API adapter<br/>[ai-search.ts]"]
  node_savedapi["Saved API adapter<br/>[saved.ts]"]
  node_historyapi["History API adapter<br/>[history.ts]"]
  node_authpage["Login and registration<br/>[Login.tsx]"]
  node_authapi["Auth API adapter<br/>[auth.ts]"]
end

subgraph group_services["Backend API"]
  node_backend["HTTP application<br/>[app.ts]"]
  node_routes["API route registry<br/>[index.ts]"]
  node_airoute["AI endpoints<br/>[ai.ts]"]
  node_savedroute["Saved endpoints<br/>[saved.ts]"]
  node_historyroute["History endpoints<br/>[history.ts]"]
end

subgraph group_identity["Accounts and identity"]
  node_authroute["Account endpoints<br/>[auth.ts]"]
end

subgraph group_data["Persistence"]
  node_db["Database access<br/>[index.ts]"]
  node_schema["Data schema<br/>[index.ts]"]
end

node_user(("User"))
node_mail["Email service"]

node_user -->|"uses"| node_frontend
node_frontend -->|"routes to"| node_discovery
node_frontend -->|"routes to"| node_savedpage
node_frontend -->|"routes to"| node_historypage
node_frontend -->|"routes to"| node_authpage
node_frontend -->|"loads saved items"| node_savedapi
node_frontend -->|"loads history"| node_historyapi
node_frontend -->|"submits credentials"| node_authapi
node_discovery -->|"renders"| node_searchbar
node_discovery -->|"interprets query"| node_searchengine
node_discovery -.->|"requests AI search"| node_aiapi
node_savedpage -->|"requests saved items"| node_savedapi
node_historypage -->|"requests history"| node_historyapi
node_api -->|"sends API requests"| node_backend
node_aiapi -->|"uses transport"| node_api
node_savedapi -->|"uses transport"| node_api
node_historyapi -->|"uses transport"| node_api
node_authapi -->|"uses transport"| node_api
node_backend -->|"dispatches API requests"| node_routes
node_routes -->|"registers endpoint"| node_airoute
node_routes -->|"registers endpoint"| node_savedroute
node_routes -->|"registers endpoint"| node_historyroute
node_routes -->|"registers endpoint"| node_authroute
node_authroute -->|"reads and writes users"| node_db
node_authroute -->|"sends reset email"| node_mail
node_db -->|"uses schema"| node_schema

click node_frontend "https://github.com/shiza176/leadpilott/blob/main/frontend/src/App.tsx"
click node_discovery "https://github.com/shiza176/leadpilott/blob/main/frontend/src/pages/Discovery.tsx"
click node_searchbar "https://github.com/shiza176/leadpilott/blob/main/frontend/src/components/SearchBar.tsx"
click node_searchengine "https://github.com/shiza176/leadpilott/blob/main/frontend/src/search-engine.ts"
click node_assistant "https://github.com/shiza176/leadpilott/blob/main/frontend/src/components/AiAssistantPanel.tsx"
click node_savedpage "https://github.com/shiza176/leadpilott/blob/main/frontend/src/pages/Saved.tsx"
click node_historypage "https://github.com/shiza176/leadpilott/blob/main/frontend/src/pages/SearchHistory.tsx"
click node_api "https://github.com/shiza176/leadpilott/blob/main/frontend/src/api/client.ts"
click node_aiapi "https://github.com/shiza176/leadpilott/blob/main/frontend/src/api/ai-search.ts"
click node_savedapi "https://github.com/shiza176/leadpilott/blob/main/frontend/src/api/saved.ts"
click node_historyapi "https://github.com/shiza176/leadpilott/blob/main/frontend/src/api/history.ts"
click node_backend "https://github.com/shiza176/leadpilott/blob/main/backend/src/app.ts"
click node_routes "https://github.com/shiza176/leadpilott/blob/main/backend/src/routes/index.ts"
click node_airoute "https://github.com/shiza176/leadpilott/blob/main/backend/src/routes/ai.ts"
click node_savedroute "https://github.com/shiza176/leadpilott/blob/main/backend/src/routes/saved.ts"
click node_historyroute "https://github.com/shiza176/leadpilott/blob/main/backend/src/routes/history.ts"
click node_authroute "https://github.com/shiza176/leadpilott/blob/main/backend/src/routes/auth.ts"
click node_authpage "https://github.com/shiza176/leadpilott/blob/main/frontend/src/pages/Login.tsx"
click node_authapi "https://github.com/shiza176/leadpilott/blob/main/frontend/src/api/auth.ts"
click node_db "https://github.com/shiza176/leadpilott/blob/main/shared/db/src/index.ts"
click node_schema "https://github.com/shiza176/leadpilott/blob/main/shared/db/src/schema/index.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_frontend,node_discovery,node_searchbar,node_searchengine,node_assistant,node_savedpage,node_historypage,node_api,node_aiapi,node_savedapi,node_historyapi,node_authpage,node_authapi,node_user toneBlue
class node_backend,node_routes,node_airoute,node_savedroute,node_historyroute toneAmber
class node_authroute toneMint
class node_db,node_schema toneRose
class node_mail toneIndigo
```

## Components

### Frontend experience

- [Web application](https://github.com/shiza176/leadpilott/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Discovery search](https://github.com/shiza176/leadpilott/blob/main/frontend/src/pages/Discovery.tsx): `frontend/src/pages/Discovery.tsx`
- [Search controls](https://github.com/shiza176/leadpilott/blob/main/frontend/src/components/SearchBar.tsx): `frontend/src/components/SearchBar.tsx`
- [Search interpretation](https://github.com/shiza176/leadpilott/blob/main/frontend/src/search-engine.ts): `frontend/src/search-engine.ts`
- [AI assistant](https://github.com/shiza176/leadpilott/blob/main/frontend/src/components/AiAssistantPanel.tsx): `frontend/src/components/AiAssistantPanel.tsx`
- [Saved items](https://github.com/shiza176/leadpilott/blob/main/frontend/src/pages/Saved.tsx): `frontend/src/pages/Saved.tsx`
- [Search history](https://github.com/shiza176/leadpilott/blob/main/frontend/src/pages/SearchHistory.tsx): `frontend/src/pages/SearchHistory.tsx`
- [API client](https://github.com/shiza176/leadpilott/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [AI API adapter](https://github.com/shiza176/leadpilott/blob/main/frontend/src/api/ai-search.ts): `frontend/src/api/ai-search.ts`
- [Saved API adapter](https://github.com/shiza176/leadpilott/blob/main/frontend/src/api/saved.ts): `frontend/src/api/saved.ts`
- [History API adapter](https://github.com/shiza176/leadpilott/blob/main/frontend/src/api/history.ts): `frontend/src/api/history.ts`
- [Login and registration](https://github.com/shiza176/leadpilott/blob/main/frontend/src/pages/Login.tsx): `frontend/src/pages/Login.tsx`
- [Auth API adapter](https://github.com/shiza176/leadpilott/blob/main/frontend/src/api/auth.ts): `frontend/src/api/auth.ts`

### Backend API

- [HTTP application](https://github.com/shiza176/leadpilott/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [API route registry](https://github.com/shiza176/leadpilott/blob/main/backend/src/routes/index.ts): `backend/src/routes/index.ts`
- [AI endpoints](https://github.com/shiza176/leadpilott/blob/main/backend/src/routes/ai.ts): `backend/src/routes/ai.ts`
- [Saved endpoints](https://github.com/shiza176/leadpilott/blob/main/backend/src/routes/saved.ts): `backend/src/routes/saved.ts`
- [History endpoints](https://github.com/shiza176/leadpilott/blob/main/backend/src/routes/history.ts): `backend/src/routes/history.ts`

### Accounts and identity

- [Account endpoints](https://github.com/shiza176/leadpilott/blob/main/backend/src/routes/auth.ts): `backend/src/routes/auth.ts`

### Persistence

- [Database access](https://github.com/shiza176/leadpilott/blob/main/shared/db/src/index.ts): `shared/db/src/index.ts`
- [Data schema](https://github.com/shiza176/leadpilott/blob/main/shared/db/src/schema/index.ts): `shared/db/src/schema/index.ts`

### Other components

- **User**
- **Email service**

## Connections

- User → Web application: uses
- Web application → Discovery search: routes to
- Web application → Saved items: routes to
- Web application → Search history: routes to
- Web application → Login and registration: routes to
- Web application → Saved API adapter: loads saved items
- Web application → History API adapter: loads history
- Web application → Auth API adapter: submits credentials
- Discovery search → Search controls: renders
- Discovery search → Search interpretation: interprets query
- Discovery search → AI API adapter: requests AI search
- Saved items → Saved API adapter: requests saved items
- Search history → History API adapter: requests history
- API client → HTTP application: sends API requests
- AI API adapter → API client: uses transport
- Saved API adapter → API client: uses transport
- History API adapter → API client: uses transport
- Auth API adapter → API client: uses transport
- HTTP application → API route registry: dispatches API requests
- API route registry → AI endpoints: registers endpoint
- API route registry → Saved endpoints: registers endpoint
- API route registry → History endpoints: registers endpoint
- API route registry → Account endpoints: registers endpoint
- Account endpoints → Database access: reads and writes users
- Account endpoints → Email service: sends reset email
- Database access → Data schema: uses schema
