# thanhhbinh023/presaleee architecture

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

- Interactive diagram: https://gitdiagram.com/thanhhbinh023/presaleee
- Repository: https://github.com/thanhhbinh023/presaleee

## Overview

Presaleee is an AI-assisted presales and proposal platform: staff use a web workspace to manage clients, leads, discovery meetings, knowledge, and proposals; the API applies business workflows and persists organization-scoped data. Its documented discovery flow includes transcript intake, meeting lifecycle management, AI inspection, gap analysis, and follow-up questions carried into later meetings. The AI engine is an optional Python service, with backend fallback capability. Some connections below are documented at product level; unsampled implementation links are omitted or marked unverified.

Main entry points: [`frontend/src/App.tsx`](https://github.com/thanhhbinh023/presaleee/blob/main/frontend/src/App.tsx) (Web application), [`frontend/src/services/apiClient.ts`](https://github.com/thanhhbinh023/presaleee/blob/main/frontend/src/services/apiClient.ts) (API client), [`backend/src/presentation/controllers/RAGController.ts`](https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/presentation/controllers/RAGController.ts) (Knowledge endpoints), [`backend/src/application/use-cases/IngestDocumentUseCase.ts`](https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/application/use-cases/IngestDocumentUseCase.ts) (Document ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Staff workspace"]
  node_workspace["Web application<br/>[App.tsx]"]
  node_auth_ui["Session and access<br/>[useAuth.tsx]"]
  node_client_ui["Client directory"]
  node_discovery_ui["Discovery workspace<br/>[AIWorkspace.tsx]"]
  node_proposal_ui["Proposal studio"]
  node_api_client["API client<br/>[apiClient.ts]"]
end

subgraph group_api["Business API"]
  node_api_routes["HTTP routes<br/>[index.ts]"]
  node_auth["Authentication"]
  node_client_lead["Client and lead workflows<br/>[LeadUseCases.ts]"]
  node_meeting["Meeting lifecycle<br/>[MeetingUseCases.ts]"]
  node_proposal_controller["Proposal endpoints"]
  node_proposal_logic["Proposal generation"]
  node_knowledge_controller["Knowledge endpoints<br/>[RAGController.ts]"]
  node_ingest["Document ingestion"]
  node_rag_search["Hybrid knowledge search"]
end

subgraph group_ai["AI capabilities"]
  node_ai_service["Python AI engine<br/>[server.py]"]
  node_ai_gateway["AI gateways"]
end

subgraph group_state["Persistence and integrations"]
  node_postgres[("PostgreSQL and vectors<br/>[connection.ts]")]
  node_repositories["Persistence adapters"]
  node_exporters["Proposal exports"]
end

node_staff(("Presales staff"))
node_external_meetings(("Meeting transcript sources"))

node_staff -->|"uses"| node_workspace
node_workspace -->|"manages session"| node_auth_ui
node_workspace -->|"opens directory"| node_client_ui
node_workspace -->|"opens workspace"| node_discovery_ui
node_workspace -->|"opens studio"| node_proposal_ui
node_client_ui -->|"requests data"| node_api_client
node_auth_ui -->|"calls API"| node_api_client
node_workspace -.->|"uses API"| node_api_client
node_api_client -.->|"sends requests"| node_api_routes
node_api_routes -->|"guards sessions"| node_auth
node_external_meetings -.->|"provides transcripts"| node_meeting
node_meeting -.->|"requests inspection"| node_ai_gateway
node_knowledge_controller -->|"invokes ingestion"| node_ingest
node_knowledge_controller -->|"invokes search"| node_rag_search
node_knowledge_controller -->|"invokes generation"| node_proposal_logic
node_ingest -->|"writes documents"| node_repositories
node_ingest -->|"creates embeddings"| node_ai_gateway
node_rag_search -->|"searches knowledge"| node_repositories
node_proposal_controller -->|"dispatches generation"| node_proposal_logic
node_proposal_controller -.->|"dispatches exports"| node_exporters
node_ai_gateway -.->|"calls engine"| node_ai_service
node_repositories -.->|"persists records"| node_postgres

click node_workspace "https://github.com/thanhhbinh023/presaleee/blob/main/frontend/src/App.tsx"
click node_auth_ui "https://github.com/thanhhbinh023/presaleee/blob/main/frontend/src/hooks/useAuth.tsx"
click node_client_ui "https://github.com/thanhhbinh023/presaleee/blob/main/frontend/src/components/ClientsDirectory.tsx"
click node_discovery_ui "https://github.com/thanhhbinh023/presaleee/blob/main/frontend/src/components/AIWorkspace.tsx"
click node_proposal_ui "https://github.com/thanhhbinh023/presaleee/blob/main/frontend/src/components/ProposalsStudio.tsx"
click node_api_client "https://github.com/thanhhbinh023/presaleee/blob/main/frontend/src/services/apiClient.ts"
click node_api_routes "https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/presentation/routes/index.ts"
click node_auth "https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/application/services/AuthTokenService.ts"
click node_client_lead "https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/application/use-cases/LeadUseCases.ts"
click node_meeting "https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/application/use-cases/MeetingUseCases.ts"
click node_proposal_controller "https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/presentation/controllers/ProposalController.ts"
click node_proposal_logic "https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/application/use-cases/GenerateProposalUseCase.ts"
click node_knowledge_controller "https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/presentation/controllers/RAGController.ts"
click node_ingest "https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/application/use-cases/IngestDocumentUseCase.ts"
click node_rag_search "https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/application/use-cases/SearchHybridRAGUseCase.ts"
click node_ai_service "https://github.com/thanhhbinh023/presaleee/blob/main/ai/server.py"
click node_ai_gateway "https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/infrastructure/ai/FastAPILMGateway.ts"
click node_postgres "https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/infrastructure/database/connection.ts"
click node_repositories "https://github.com/thanhhbinh023/presaleee/tree/main/backend/src/infrastructure/database/repositories"
click node_exporters "https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/infrastructure/services/ExcelProposalExporterService.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_workspace,node_auth_ui,node_client_ui,node_discovery_ui,node_proposal_ui,node_api_client toneBlue
class node_api_routes,node_auth,node_client_lead,node_meeting,node_proposal_controller,node_proposal_logic,node_knowledge_controller,node_ingest,node_rag_search toneAmber
class node_ai_service,node_ai_gateway toneMint
class node_postgres,node_repositories,node_exporters toneRose
class node_staff,node_external_meetings toneIndigo
```

## Components

### Staff workspace

- [Web application](https://github.com/thanhhbinh023/presaleee/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Session and access](https://github.com/thanhhbinh023/presaleee/blob/main/frontend/src/hooks/useAuth.tsx): `frontend/src/hooks/useAuth.tsx`
- [Client directory](https://github.com/thanhhbinh023/presaleee/blob/main/frontend/src/components/ClientsDirectory.tsx): `frontend/src/components/ClientsDirectory.tsx`
- [Discovery workspace](https://github.com/thanhhbinh023/presaleee/blob/main/frontend/src/components/AIWorkspace.tsx): `frontend/src/components/AIWorkspace.tsx`
- [Proposal studio](https://github.com/thanhhbinh023/presaleee/blob/main/frontend/src/components/ProposalsStudio.tsx): `frontend/src/components/ProposalsStudio.tsx`
- [API client](https://github.com/thanhhbinh023/presaleee/blob/main/frontend/src/services/apiClient.ts): `frontend/src/services/apiClient.ts`

### Business API

- [HTTP routes](https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/presentation/routes/index.ts): `backend/src/presentation/routes/index.ts`
- [Authentication](https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/application/services/AuthTokenService.ts): `backend/src/application/services/AuthTokenService.ts`
- [Client and lead workflows](https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/application/use-cases/LeadUseCases.ts): `backend/src/application/use-cases/LeadUseCases.ts`
- [Meeting lifecycle](https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/application/use-cases/MeetingUseCases.ts): `backend/src/application/use-cases/MeetingUseCases.ts`
- [Proposal endpoints](https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/presentation/controllers/ProposalController.ts): `backend/src/presentation/controllers/ProposalController.ts`
- [Proposal generation](https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/application/use-cases/GenerateProposalUseCase.ts): `backend/src/application/use-cases/GenerateProposalUseCase.ts`
- [Knowledge endpoints](https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/presentation/controllers/RAGController.ts): `backend/src/presentation/controllers/RAGController.ts`
- [Document ingestion](https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/application/use-cases/IngestDocumentUseCase.ts): `backend/src/application/use-cases/IngestDocumentUseCase.ts`
- [Hybrid knowledge search](https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/application/use-cases/SearchHybridRAGUseCase.ts): `backend/src/application/use-cases/SearchHybridRAGUseCase.ts`

### AI capabilities

- [Python AI engine](https://github.com/thanhhbinh023/presaleee/blob/main/ai/server.py): `ai/server.py`
- [AI gateways](https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/infrastructure/ai/FastAPILMGateway.ts): `backend/src/infrastructure/ai/FastAPILMGateway.ts`

### Persistence and integrations

- [PostgreSQL and vectors](https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/infrastructure/database/connection.ts): `backend/src/infrastructure/database/connection.ts`
- [Persistence adapters](https://github.com/thanhhbinh023/presaleee/tree/main/backend/src/infrastructure/database/repositories): `backend/src/infrastructure/database/repositories`
- [Proposal exports](https://github.com/thanhhbinh023/presaleee/blob/main/backend/src/infrastructure/services/ExcelProposalExporterService.ts): `backend/src/infrastructure/services/ExcelProposalExporterService.ts`

### Other components

- **Presales staff**
- **Meeting transcript sources**

## Connections

- Presales staff → Web application: uses (evidence: `README.md`)
- Web application → Session and access: manages session (evidence: `frontend/src/App.tsx`)
- Web application → Client directory: opens directory (evidence: `frontend/src/App.tsx`)
- Web application → Discovery workspace: opens workspace (evidence: `frontend/src/App.tsx`)
- Web application → Proposal studio: opens studio (evidence: `frontend/src/App.tsx`)
- Client directory → API client: requests data (evidence: `frontend/src/components/ClientsDirectory.tsx`)
- Session and access → API client: calls API (evidence: `frontend/src/hooks/useAuth.tsx`)
- Web application → API client: uses API (evidence: `README.md`)
- API client → HTTP routes: sends requests (evidence: `README.md`)
- HTTP routes → Authentication: guards sessions
- Meeting transcript sources → Meeting lifecycle: provides transcripts (evidence: `README.md`)
- Meeting lifecycle → AI gateways: requests inspection (evidence: `README.md`)
- Knowledge endpoints → Document ingestion: invokes ingestion (evidence: `backend/src/presentation/controllers/RAGController.ts`)
- Knowledge endpoints → Hybrid knowledge search: invokes search (evidence: `backend/src/presentation/controllers/RAGController.ts`)
- Knowledge endpoints → Proposal generation: invokes generation (evidence: `backend/src/presentation/controllers/RAGController.ts`)
- Document ingestion → Persistence adapters: writes documents (evidence: `backend/src/application/use-cases/IngestDocumentUseCase.ts`)
- Document ingestion → AI gateways: creates embeddings (evidence: `backend/src/application/use-cases/IngestDocumentUseCase.ts`)
- Hybrid knowledge search → Persistence adapters: searches knowledge (evidence: `backend/src/application/use-cases/SearchHybridRAGUseCase.ts`)
- Proposal endpoints → Proposal generation: dispatches generation (evidence: `backend/src/presentation/controllers/ProposalController.ts`)
- Proposal endpoints → Proposal exports: dispatches exports (evidence: `backend/src/presentation/controllers/ProposalController.ts`)
- AI gateways → Python AI engine: calls engine (evidence: `README.md`)
- Persistence adapters → PostgreSQL and vectors: persists records (evidence: `README.md`)
