# juhee067/cs-knowledge-hub architecture

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

- Interactive diagram: https://gitdiagram.com/juhee067/cs-knowledge-hub
- Repository: https://github.com/juhee067/cs-knowledge-hub

## Overview

CS Knowledge Hub is an internal platform for collecting customer-support knowledge and helping staff find and apply it. The main workflow runs from inquiry intake or manual entry, through inquiry handling and classification, to reusable FAQ knowledge; staff can then search or ask the Hub for evidence-based answer drafts. Separate branches manage FAQ lifecycle, client-specific settings, imports, and the assetization queue. The graph combines shown frontend/API relationships with README-documented capabilities; several pages, APIs, and Edge Functions were not excerpted, so their internal call wiring is not asserted.

Main entry points: [`src/App.tsx`](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/App.tsx) (App routing), [`src/api/clients.ts`](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/api/clients.ts) (Client API), [`src/pages/SearchPage.tsx`](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/pages/SearchPage.tsx) (Knowledge search), [`src/pages/FaqListPage.tsx`](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/pages/FaqListPage.tsx) (FAQ screens)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Staff experience"]
  node_app["App routing<br/>[App.tsx]"]
  node_auth["Auth context<br/>[AuthContext.tsx]"]
  node_searchpage["Knowledge search<br/>[SearchPage.tsx]"]
  node_askpage["Ask the Hub<br/>[AskHubPage.tsx]"]
  node_chatapi["Chat API<br/>[chat.ts]"]
end

subgraph group_knowledge["Knowledge management"]
  node_faqscreens["FAQ screens<br/>[FaqListPage.tsx]"]
  node_clients["Client settings<br/>[ClientsPage.tsx]"]
  node_import["Knowledge import<br/>[ImportPage.tsx]"]
  node_faqapi["FAQ API<br/>[faqs.ts]"]
  node_categoryapi["Category API<br/>[categories.ts]"]
  node_clientapi["Client API<br/>[clients.ts]"]
  node_audit["Audit log API<br/>[audit.ts]"]
  node_searchapi["Search API<br/>[search.ts]"]
end

subgraph group_inquiries["Inquiry operations"]
  node_inbox["Inquiry inbox<br/>[InboxPage.tsx]"]
  node_quickinput["Quick intake<br/>[QuickInputPage.tsx]"]
  node_process["Inquiry processing"]
  node_inquiryapi["Inquiry API<br/>[inquiries.ts]"]
  node_classifyapi["Classification API<br/>[classify.ts]"]
  node_intakeapi["Intake API<br/>[intake.ts]"]
  node_assetqueue["Assetization queue"]
end

subgraph group_backend["Supabase services"]
  node_searchfn["Knowledge search service<br/>[index.ts]"]
  node_intakeconnectors{{"Channel connectors"}}
  node_sharedintake["Shared intake logic<br/>[intake.ts]"]
  node_classifyfn["Inquiry classifier<br/>[index.ts]"]
  node_assetizefn["Assetization service<br/>[index.ts]"]
  node_chatfn["Chat service<br/>[index.ts]"]
  node_embedfn["FAQ embeddings<br/>[index.ts]"]
  node_dbclient["Supabase client<br/>[supabase.ts]"]
  node_database[("Supabase database")]
end

node_staff(("Support staff"))

node_staff -->|"opens"| node_app
node_app -->|"provides auth"| node_auth
node_app -->|"routes to"| node_searchpage
node_app -->|"routes to"| node_askpage
node_app -->|"routes to"| node_faqscreens
node_app -->|"routes to"| node_inbox
node_app -->|"routes to"| node_process
node_app -->|"routes to"| node_assetqueue
node_app -->|"routes to"| node_import
node_searchpage -->|"calls search"| node_searchapi
node_searchpage -->|"loads clients"| node_clientapi
node_searchpage -->|"loads categories"| node_categoryapi
node_searchapi -->|"queries"| node_dbclient
node_searchapi -.->|"uses hybrid search"| node_searchfn
node_askpage -->|"imports"| node_chatapi
node_chatapi -.->|"requests answers"| node_chatfn
node_chatfn -.->|"retrieves evidence"| node_searchfn
node_faqscreens -->|"uses FAQ API"| node_faqapi
node_faqscreens -->|"loads categories"| node_categoryapi
node_faqscreens -->|"loads clients"| node_clientapi
node_clients -->|"calls client API"| node_clientapi
node_clientapi -->|"logs changes"| node_audit
node_import -->|"uses intake API"| node_intakeapi
node_inbox -.->|"loads inquiries"| node_inquiryapi
node_quickinput -.->|"submits intake"| node_intakeapi
node_process -->|"uses classification"| node_classifyapi
node_process -->|"uses inquiry API"| node_inquiryapi
node_process -->|"loads client rules"| node_clientapi
node_classifyapi -->|"uses search"| node_searchapi
node_classifyapi -.->|"classifies inquiries"| node_classifyfn
node_intakeconnectors -->|"shares intake logic"| node_sharedintake
node_intakeconnectors -.->|"stores inquiries"| node_database
node_intakeapi -.->|"imports data"| node_database
node_assetqueue -.->|"manages queued items"| node_assetizefn
node_assetizefn -.->|"records assets"| node_database
node_embedfn -.->|"stores embeddings"| node_database
node_dbclient -->|"connects"| node_database
node_auth -->|"uses client"| node_dbclient

click node_app "https://github.com/juhee067/cs-knowledge-hub/blob/main/src/App.tsx"
click node_auth "https://github.com/juhee067/cs-knowledge-hub/blob/main/src/contexts/AuthContext.tsx"
click node_searchpage "https://github.com/juhee067/cs-knowledge-hub/blob/main/src/pages/SearchPage.tsx"
click node_askpage "https://github.com/juhee067/cs-knowledge-hub/blob/main/src/pages/AskHubPage.tsx"
click node_faqscreens "https://github.com/juhee067/cs-knowledge-hub/blob/main/src/pages/FaqListPage.tsx"
click node_clients "https://github.com/juhee067/cs-knowledge-hub/blob/main/src/pages/ClientsPage.tsx"
click node_import "https://github.com/juhee067/cs-knowledge-hub/blob/main/src/pages/ImportPage.tsx"
click node_faqapi "https://github.com/juhee067/cs-knowledge-hub/blob/main/src/api/faqs.ts"
click node_categoryapi "https://github.com/juhee067/cs-knowledge-hub/blob/main/src/api/categories.ts"
click node_clientapi "https://github.com/juhee067/cs-knowledge-hub/blob/main/src/api/clients.ts"
click node_audit "https://github.com/juhee067/cs-knowledge-hub/blob/main/src/api/audit.ts"
click node_searchapi "https://github.com/juhee067/cs-knowledge-hub/blob/main/src/api/search.ts"
click node_searchfn "https://github.com/juhee067/cs-knowledge-hub/blob/main/supabase/functions/search-knowledge/index.ts"
click node_inbox "https://github.com/juhee067/cs-knowledge-hub/blob/main/src/pages/InboxPage.tsx"
click node_quickinput "https://github.com/juhee067/cs-knowledge-hub/blob/main/src/pages/QuickInputPage.tsx"
click node_process "https://github.com/juhee067/cs-knowledge-hub/blob/main/src/pages/ProcessInquiryPage.tsx"
click node_inquiryapi "https://github.com/juhee067/cs-knowledge-hub/blob/main/src/api/inquiries.ts"
click node_classifyapi "https://github.com/juhee067/cs-knowledge-hub/blob/main/src/api/classify.ts"
click node_intakeapi "https://github.com/juhee067/cs-knowledge-hub/blob/main/src/api/intake.ts"
click node_assetqueue "https://github.com/juhee067/cs-knowledge-hub/blob/main/src/pages/AssetizeQueuePage.tsx"
click node_intakeconnectors "https://github.com/juhee067/cs-knowledge-hub/tree/main/supabase/functions"
click node_sharedintake "https://github.com/juhee067/cs-knowledge-hub/blob/main/supabase/functions/_shared/intake.ts"
click node_classifyfn "https://github.com/juhee067/cs-knowledge-hub/blob/main/supabase/functions/classify-inquiry/index.ts"
click node_assetizefn "https://github.com/juhee067/cs-knowledge-hub/blob/main/supabase/functions/assetize/index.ts"
click node_chatapi "https://github.com/juhee067/cs-knowledge-hub/blob/main/src/api/chat.ts"
click node_chatfn "https://github.com/juhee067/cs-knowledge-hub/blob/main/supabase/functions/chat/index.ts"
click node_embedfn "https://github.com/juhee067/cs-knowledge-hub/blob/main/supabase/functions/embed-faq/index.ts"
click node_dbclient "https://github.com/juhee067/cs-knowledge-hub/blob/main/src/lib/supabase.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_app,node_auth,node_searchpage,node_askpage,node_chatapi toneBlue
class node_faqscreens,node_clients,node_import,node_faqapi,node_categoryapi,node_clientapi,node_audit,node_searchapi toneAmber
class node_inbox,node_quickinput,node_process,node_inquiryapi,node_classifyapi,node_intakeapi,node_assetqueue toneMint
class node_searchfn,node_intakeconnectors,node_sharedintake,node_classifyfn,node_assetizefn,node_chatfn,node_embedfn,node_dbclient,node_database toneRose
class node_staff toneIndigo
```

## Components

### Staff experience

- [App routing](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/App.tsx): `src/App.tsx`
- [Auth context](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/contexts/AuthContext.tsx): `src/contexts/AuthContext.tsx`
- [Knowledge search](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/pages/SearchPage.tsx): `src/pages/SearchPage.tsx`
- [Ask the Hub](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/pages/AskHubPage.tsx): `src/pages/AskHubPage.tsx`
- [Chat API](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/api/chat.ts): `src/api/chat.ts`

### Knowledge management

- [FAQ screens](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/pages/FaqListPage.tsx): `src/pages/FaqListPage.tsx`
- [Client settings](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/pages/ClientsPage.tsx): `src/pages/ClientsPage.tsx`
- [Knowledge import](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/pages/ImportPage.tsx): `src/pages/ImportPage.tsx`
- [FAQ API](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/api/faqs.ts): `src/api/faqs.ts`
- [Category API](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/api/categories.ts): `src/api/categories.ts`
- [Client API](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/api/clients.ts): `src/api/clients.ts`
- [Audit log API](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/api/audit.ts): `src/api/audit.ts`
- [Search API](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/api/search.ts): `src/api/search.ts`

### Inquiry operations

- [Inquiry inbox](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/pages/InboxPage.tsx): `src/pages/InboxPage.tsx`
- [Quick intake](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/pages/QuickInputPage.tsx): `src/pages/QuickInputPage.tsx`
- [Inquiry processing](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/pages/ProcessInquiryPage.tsx): `src/pages/ProcessInquiryPage.tsx`
- [Inquiry API](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/api/inquiries.ts): `src/api/inquiries.ts`
- [Classification API](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/api/classify.ts): `src/api/classify.ts`
- [Intake API](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/api/intake.ts): `src/api/intake.ts`
- [Assetization queue](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/pages/AssetizeQueuePage.tsx): `src/pages/AssetizeQueuePage.tsx`

### Supabase services

- [Knowledge search service](https://github.com/juhee067/cs-knowledge-hub/blob/main/supabase/functions/search-knowledge/index.ts): `supabase/functions/search-knowledge/index.ts`
- [Channel connectors](https://github.com/juhee067/cs-knowledge-hub/tree/main/supabase/functions): `supabase/functions`
- [Shared intake logic](https://github.com/juhee067/cs-knowledge-hub/blob/main/supabase/functions/_shared/intake.ts): `supabase/functions/_shared/intake.ts`
- [Inquiry classifier](https://github.com/juhee067/cs-knowledge-hub/blob/main/supabase/functions/classify-inquiry/index.ts): `supabase/functions/classify-inquiry/index.ts`
- [Assetization service](https://github.com/juhee067/cs-knowledge-hub/blob/main/supabase/functions/assetize/index.ts): `supabase/functions/assetize/index.ts`
- [Chat service](https://github.com/juhee067/cs-knowledge-hub/blob/main/supabase/functions/chat/index.ts): `supabase/functions/chat/index.ts`
- [FAQ embeddings](https://github.com/juhee067/cs-knowledge-hub/blob/main/supabase/functions/embed-faq/index.ts): `supabase/functions/embed-faq/index.ts`
- [Supabase client](https://github.com/juhee067/cs-knowledge-hub/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`
- **Supabase database**

### Other components

- **Support staff**

## Connections

- Support staff → App routing: opens (evidence: `src/App.tsx`)
- App routing → Auth context: provides auth (evidence: `src/App.tsx`)
- App routing → Knowledge search: routes to (evidence: `src/App.tsx`)
- App routing → Ask the Hub: routes to (evidence: `src/App.tsx`)
- App routing → FAQ screens: routes to (evidence: `src/App.tsx`)
- App routing → Inquiry inbox: routes to (evidence: `src/App.tsx`)
- App routing → Inquiry processing: routes to (evidence: `src/App.tsx`)
- App routing → Assetization queue: routes to (evidence: `src/App.tsx`)
- App routing → Knowledge import: routes to (evidence: `src/App.tsx`)
- Knowledge search → Search API: calls search (evidence: `src/pages/SearchPage.tsx`)
- Knowledge search → Client API: loads clients (evidence: `src/pages/SearchPage.tsx`)
- Knowledge search → Category API: loads categories (evidence: `src/pages/SearchPage.tsx`)
- Search API → Supabase client: queries (evidence: `src/api/search.ts`)
- Search API → Knowledge search service: uses hybrid search (evidence: `README.md`)
- Ask the Hub → Chat API: imports (evidence: `src/pages/AskHubPage.tsx`)
- Chat API → Chat service: requests answers (evidence: `README.md`)
- Chat service → Knowledge search service: retrieves evidence (evidence: `README.md`)
- FAQ screens → FAQ API: uses FAQ API (evidence: `src/pages/FaqListPage.tsx`)
- FAQ screens → Category API: loads categories (evidence: `src/pages/FaqListPage.tsx`)
- FAQ screens → Client API: loads clients (evidence: `src/pages/FaqListPage.tsx`)
- Client settings → Client API: calls client API (evidence: `src/pages/ClientsPage.tsx`)
- Client API → Audit log API: logs changes (evidence: `src/api/clients.ts`)
- Knowledge import → Intake API: uses intake API (evidence: `src/pages/ImportPage.tsx`)
- Inquiry inbox → Inquiry API: loads inquiries
- Quick intake → Intake API: submits intake
- Inquiry processing → Classification API: uses classification (evidence: `src/pages/ProcessInquiryPage.tsx`)
- Inquiry processing → Inquiry API: uses inquiry API (evidence: `src/pages/ProcessInquiryPage.tsx`)
- Inquiry processing → Client API: loads client rules (evidence: `src/pages/ProcessInquiryPage.tsx`)
- Classification API → Search API: uses search (evidence: `src/api/classify.ts`)
- Classification API → Inquiry classifier: classifies inquiries
- Channel connectors → Shared intake logic: shares intake logic (evidence: `supabase/functions/intake-email/index.ts`)
- Channel connectors → Supabase database: stores inquiries (evidence: `README.md`)
- Intake API → Supabase database: imports data (evidence: `README.md`)
- Assetization queue → Assetization service: manages queued items (evidence: `README.md`)
- Assetization service → Supabase database: records assets (evidence: `README.md`)
- FAQ embeddings → Supabase database: stores embeddings (evidence: `README.md`)
- Supabase client → Supabase database: connects (evidence: `src/lib/supabase.ts`)
- Auth context → Supabase client: uses client (evidence: `src/contexts/AuthContext.tsx`)
