# chauhanjaved/ask-my-docs architecture

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

- Interactive diagram: https://gitdiagram.com/chauhanjaved/ask-my-docs
- Repository: https://github.com/chauhanjaved/ask-my-docs

## Overview

FTChat turns business knowledge into an embeddable support assistant. The main workflow is to upload documents or crawl a URL, process and embed its content, then answer widget questions through chat; the dashboard also exposes conversation analytics, team management, and billing. The graph includes these documented capabilities, but unsampled implementations are represented only at supported directory paths. Relationships are limited to excerpted calls, indexed imports, or README statements; the internal retrieval and answer-generation steps were not inspected.

Main entry points: [`src/lib/document-processing.ts`](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/lib/document-processing.ts) (Text processing), [`src/app/api/documents/route.ts`](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/api/documents/route.ts) (File ingestion), [`src/app/api/crawl/route.ts`](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/api/crawl/route.ts) (URL ingestion), [`src/utils/supabase/server.ts`](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/utils/supabase/server.ts) (Server client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Knowledge ingestion"]
  node_documents_ui["Document manager<br/>[page.tsx]"]
  node_upload_api["File ingestion<br/>[route.ts]"]
  node_crawl_api["URL ingestion<br/>[route.ts]"]
  node_processing["Text processing"]
  node_embedding_service["Embedding API"]
end

subgraph group_assistant["Support assistant"]
  node_widget_script["Embed loader<br/>[loader.ts]"]
  node_widget["Chat widget<br/>[route.ts]"]
  node_chat_api["Chat endpoint<br/>[route.ts]"]
  node_search_api["Knowledge search<br/>[route.ts]"]
end

subgraph group_workspace["Business workspace"]
  node_dashboard["Dashboard"]
  node_conversations["Chat analytics<br/>[page.tsx]"]
  node_team["Team management<br/>[page.tsx]"]
  node_permissions["Role permissions<br/>[permissions.ts]"]
  node_billing["Subscription billing<br/>[page.tsx]"]
  node_profile_settings["Profile settings"]
  node_marketing["Marketing site"]
  node_site_config["Site configuration<br/>[site.ts]"]
  node_dashboard_nav["Dashboard navigation<br/>[dashboard-nav.tsx]"]
  node_plans["Plan limits<br/>[plans.ts]"]
end

subgraph group_platform["Platform services"]
  node_stripe["Stripe billing"]
  node_subscription_functions["Subscription functions<br/>[index.ts]"]
  node_subscription_webhook["Billing webhook<br/>[index.ts]"]
  node_supabase[("Supabase")]
  node_server_client["Server client<br/>[server.ts]"]
  node_admin_client["Admin client<br/>[admin.ts]"]
  node_browser_client["Browser client<br/>[client.ts]"]
end

node_business(("Business owner"))
node_customer(("Website visitor"))

node_business -->|"manages knowledge"| node_documents_ui
node_business -->|"reviews workspace"| node_dashboard
node_customer -->|"loads widget"| node_widget_script
node_widget_script -.->|"loads embed"| node_widget
node_widget -->|"posts questions"| node_chat_api
node_documents_ui -.->|"uploads files"| node_upload_api
node_documents_ui -.->|"submits URLs"| node_crawl_api
node_upload_api -->|"extracts and chunks"| node_processing
node_crawl_api -->|"chunks text"| node_processing
node_processing -->|"requests embeddings"| node_embedding_service
node_upload_api -->|"creates client"| node_server_client
node_crawl_api -->|"creates client"| node_server_client
node_chat_api -->|"creates client"| node_server_client
node_chat_api -->|"uses processing"| node_processing
node_upload_api -->|"stores documents"| node_supabase
node_crawl_api -->|"stores chunks"| node_supabase
node_server_client -->|"connects to"| node_supabase
node_admin_client -->|"connects to"| node_supabase
node_search_api -->|"uses processing"| node_processing
node_team -.->|"uses access rules"| node_permissions
node_dashboard_nav -->|"checks roles"| node_permissions
node_permissions -->|"checks plan limits"| node_plans
node_profile_settings -->|"creates client"| node_browser_client
node_dashboard_nav -->|"creates client"| node_browser_client
node_billing -.->|"manages subscriptions"| node_stripe
node_stripe -.->|"sends events"| node_subscription_webhook
node_subscription_functions -.->|"uses platform"| node_supabase
node_subscription_webhook -.->|"uses platform"| node_supabase
node_marketing -->|"uses site details"| node_site_config

click node_dashboard "https://github.com/chauhanjaved/ask-my-docs/tree/main/src/app/(dashboard)/dashboard"
click node_documents_ui "https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/(dashboard)/dashboard/documents/page.tsx"
click node_upload_api "https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/api/documents/route.ts"
click node_crawl_api "https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/api/crawl/route.ts"
click node_processing "https://github.com/chauhanjaved/ask-my-docs/blob/main/src/lib/document-processing.ts"
click node_widget_script "https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/widget/loader.ts"
click node_widget "https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/widget/embed/route.ts"
click node_chat_api "https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/api/chat/route.ts"
click node_search_api "https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/api/search/route.ts"
click node_conversations "https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/(dashboard)/dashboard/chats/page.tsx"
click node_team "https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/(dashboard)/dashboard/settings/team/page.tsx"
click node_permissions "https://github.com/chauhanjaved/ask-my-docs/blob/main/src/lib/permissions.ts"
click node_billing "https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/(dashboard)/dashboard/settings/billing/page.tsx"
click node_subscription_functions "https://github.com/chauhanjaved/ask-my-docs/blob/main/supabase/functions/fastspring-subscription/index.ts"
click node_subscription_webhook "https://github.com/chauhanjaved/ask-my-docs/blob/main/supabase/functions/fastspring-webhook/index.ts"
click node_server_client "https://github.com/chauhanjaved/ask-my-docs/blob/main/src/utils/supabase/server.ts"
click node_admin_client "https://github.com/chauhanjaved/ask-my-docs/blob/main/src/utils/supabase/admin.ts"
click node_browser_client "https://github.com/chauhanjaved/ask-my-docs/blob/main/src/utils/supabase/client.ts"
click node_profile_settings "https://github.com/chauhanjaved/ask-my-docs/blob/main/src/components/profile-settings-view.tsx"
click node_marketing "https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/(marketing)/LandingPageClient.tsx"
click node_site_config "https://github.com/chauhanjaved/ask-my-docs/blob/main/src/config/site.ts"
click node_dashboard_nav "https://github.com/chauhanjaved/ask-my-docs/blob/main/src/components/dashboard-nav.tsx"
click node_plans "https://github.com/chauhanjaved/ask-my-docs/blob/main/src/lib/plans.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_documents_ui,node_upload_api,node_crawl_api,node_processing,node_embedding_service toneBlue
class node_widget_script,node_widget,node_chat_api,node_search_api toneAmber
class node_dashboard,node_conversations,node_team,node_permissions,node_billing,node_profile_settings,node_marketing,node_site_config,node_dashboard_nav,node_plans toneMint
class node_stripe,node_subscription_functions,node_subscription_webhook,node_supabase,node_server_client,node_admin_client,node_browser_client toneRose
class node_business,node_customer toneIndigo
```

## Components

### Knowledge ingestion

- [Document manager](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/(dashboard)/dashboard/documents/page.tsx): `src/app/(dashboard)/dashboard/documents/page.tsx`
- [File ingestion](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/api/documents/route.ts): `src/app/api/documents/route.ts`
- [URL ingestion](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/api/crawl/route.ts): `src/app/api/crawl/route.ts`
- [Text processing](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/lib/document-processing.ts): `src/lib/document-processing.ts`
- **Embedding API**

### Support assistant

- [Embed loader](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/widget/loader.ts): `src/app/widget/loader.ts`
- [Chat widget](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/widget/embed/route.ts): `src/app/widget/embed/route.ts`
- [Chat endpoint](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/api/chat/route.ts): `src/app/api/chat/route.ts`
- [Knowledge search](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/api/search/route.ts): `src/app/api/search/route.ts`

### Business workspace

- [Dashboard](https://github.com/chauhanjaved/ask-my-docs/tree/main/src/app/(dashboard)/dashboard): `src/app/(dashboard)/dashboard`
- [Chat analytics](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/(dashboard)/dashboard/chats/page.tsx): `src/app/(dashboard)/dashboard/chats/page.tsx`
- [Team management](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/(dashboard)/dashboard/settings/team/page.tsx): `src/app/(dashboard)/dashboard/settings/team/page.tsx`
- [Role permissions](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/lib/permissions.ts): `src/lib/permissions.ts`
- [Subscription billing](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/(dashboard)/dashboard/settings/billing/page.tsx): `src/app/(dashboard)/dashboard/settings/billing/page.tsx`
- [Profile settings](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/components/profile-settings-view.tsx): `src/components/profile-settings-view.tsx`
- [Marketing site](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/app/(marketing)/LandingPageClient.tsx): `src/app/(marketing)/LandingPageClient.tsx`
- [Site configuration](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/config/site.ts): `src/config/site.ts`
- [Dashboard navigation](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/components/dashboard-nav.tsx): `src/components/dashboard-nav.tsx`
- [Plan limits](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/lib/plans.ts): `src/lib/plans.ts`

### Platform services

- **Stripe billing**
- [Subscription functions](https://github.com/chauhanjaved/ask-my-docs/blob/main/supabase/functions/fastspring-subscription/index.ts): `supabase/functions/fastspring-subscription/index.ts`
- [Billing webhook](https://github.com/chauhanjaved/ask-my-docs/blob/main/supabase/functions/fastspring-webhook/index.ts): `supabase/functions/fastspring-webhook/index.ts`
- **Supabase**
- [Server client](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/utils/supabase/server.ts): `src/utils/supabase/server.ts`
- [Admin client](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/utils/supabase/admin.ts): `src/utils/supabase/admin.ts`
- [Browser client](https://github.com/chauhanjaved/ask-my-docs/blob/main/src/utils/supabase/client.ts): `src/utils/supabase/client.ts`

### Other components

- **Business owner**
- **Website visitor**

## Connections

- Business owner → Document manager: manages knowledge
- Business owner → Dashboard: reviews workspace
- Website visitor → Embed loader: loads widget
- Embed loader → Chat widget: loads embed
- Chat widget → Chat endpoint: posts questions (evidence: `src/app/widget/embed/route.ts`)
- Document manager → File ingestion: uploads files
- Document manager → URL ingestion: submits URLs
- File ingestion → Text processing: extracts and chunks (evidence: `src/app/api/documents/route.ts`)
- URL ingestion → Text processing: chunks text (evidence: `src/app/api/crawl/route.ts`)
- Text processing → Embedding API: requests embeddings (evidence: `src/lib/document-processing.ts`)
- File ingestion → Server client: creates client (evidence: `src/app/api/documents/route.ts`)
- URL ingestion → Server client: creates client (evidence: `src/app/api/crawl/route.ts`)
- Chat endpoint → Server client: creates client (evidence: `src/app/api/chat/route.ts`)
- Chat endpoint → Text processing: uses processing (evidence: `src/app/api/chat/route.ts`)
- File ingestion → Supabase: stores documents (evidence: `src/app/api/documents/route.ts`)
- URL ingestion → Supabase: stores chunks (evidence: `src/app/api/crawl/route.ts`)
- Server client → Supabase: connects to (evidence: `src/utils/supabase/server.ts`)
- Admin client → Supabase: connects to (evidence: `src/utils/supabase/admin.ts`)
- Knowledge search → Text processing: uses processing (evidence: `src/app/api/search/route.ts`)
- Team management → Role permissions: uses access rules
- Dashboard navigation → Role permissions: checks roles (evidence: `src/components/dashboard-nav.tsx`)
- Role permissions → Plan limits: checks plan limits (evidence: `src/lib/permissions.ts`)
- Profile settings → Browser client: creates client (evidence: `src/components/profile-settings-view.tsx`)
- Dashboard navigation → Browser client: creates client (evidence: `src/components/dashboard-nav.tsx`)
- Subscription billing → Stripe billing: manages subscriptions
- Stripe billing → Billing webhook: sends events
- Subscription functions → Supabase: uses platform
- Billing webhook → Supabase: uses platform
- Marketing site → Site configuration: uses site details
