# codingsk-dev/ai-bridge architecture

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

- Interactive diagram: https://gitdiagram.com/codingsk-dev/ai-bridge
- Repository: https://github.com/codingsk-dev/ai-bridge

## Overview

AIBridge is a business-facing platform for creating and deploying knowledge-grounded chatbots. Owners configure businesses and ingest website content or documents through the dashboard; the backend coordinates persistence and AI requests, while the Python service builds searchable knowledge and generates answers. Website visitors then use an embedded widget for text or voice interactions. The graph also preserves documented live-web fallback, reporting, and analytics capabilities. The README documents the tier-level flow; source excerpts confirm selected implementation points, but many subsystem internals and frontend-to-backend connections were not sampled.

Main entry points: [`backend/src/app.ts`](https://github.com/codingsk-dev/ai-bridge/blob/main/backend/src/app.ts) (Express Gateway), [`ai-service/app/api/router.py`](https://github.com/codingsk-dev/ai-bridge/blob/main/ai-service/app/api/router.py) (AI API), [`ai-service/app/modules/chatbot/service.py`](https://github.com/codingsk-dev/ai-bridge/blob/main/ai-service/app/modules/chatbot/service.py) (RAG Chat and Voice), [`frontend/app/api/chat/message/route.ts`](https://github.com/codingsk-dev/ai-bridge/blob/main/frontend/app/api/chat/message/route.ts) (Frontend API Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Dashboard and Widget"]
  node_dashboard["Management Dashboard<br/>[page.tsx]"]
  node_embed["Chat Widget<br/>[chatbot-widget.js]"]
  node_frontend_api["Frontend API Routes<br/>[route.ts]"]
end

subgraph group_gateway["Backend Gateway"]
  node_gateway["Express Gateway<br/>[app.ts]"]
  node_auth["Authentication<br/>[auth.service.ts]"]
  node_business["Business Management"]
  node_website["Website Ingestion<br/>[website.service.ts]"]
  node_documents["Document Upload"]
  node_chat["Chat Orchestration<br/>[chat.service.ts]"]
  node_jobs["Background Jobs<br/>[job.service.ts]"]
  node_analytics["Analytics"]
end

subgraph group_ai["AI Service"]
  node_ai_api["AI API<br/>[router.py]"]
  node_crawler["Website Crawler<br/>[crawler.py]"]
  node_document_processing["Document Processing<br/>[service.py]"]
  node_chatbot["RAG Chat and Voice<br/>[service.py]"]
  node_live_research["Live Web Research<br/>[service.py]"]
  node_reports["Readiness Reports"]
end

subgraph group_state["Persistence and Integrations"]
  node_qdrant[("Vector Index<br/>[qdrant.py]")]
  node_postgres[("Relational Database<br/>[prisma.ts]")]
  node_storage[("Supabase Storage")]
end

node_owner(("Business Owner"))
node_visitor(("Website Visitor"))

node_owner -->|"configures"| node_dashboard
node_visitor -->|"chats through"| node_embed
node_dashboard -.->|"requests"| node_frontend_api
node_embed -.->|"sends messages"| node_frontend_api
node_frontend_api -.->|"proxies requests"| node_gateway
node_gateway -->|"handles identity"| node_auth
node_gateway -->|"manages businesses"| node_business
node_gateway -->|"coordinates crawling"| node_website
node_gateway -->|"coordinates uploads"| node_documents
node_gateway -->|"orchestrates chat"| node_chat
node_gateway -->|"dispatches work"| node_jobs
node_gateway -->|"persists history"| node_analytics
node_gateway -->|"persists records"| node_postgres
node_documents -->|"stores files"| node_storage
node_gateway -->|"proxies AI work"| node_ai_api
node_ai_api -->|"routes website analysis"| node_crawler
node_ai_api -->|"routes document processing"| node_document_processing
node_ai_api -->|"routes chat"| node_chatbot
node_ai_api -->|"routes research"| node_live_research
node_ai_api -->|"routes reports"| node_reports
node_crawler -->|"indexes vectors"| node_qdrant
node_document_processing -->|"indexes chunks"| node_qdrant
node_chatbot -->|"retrieves context"| node_qdrant
node_chatbot -->|"augments answers"| node_live_research
node_chatbot -->|"returns answer"| node_visitor

click node_dashboard "https://github.com/codingsk-dev/ai-bridge/blob/main/frontend/app/dashboard/page.tsx"
click node_embed "https://github.com/codingsk-dev/ai-bridge/blob/main/frontend/public/chatbot-widget.js"
click node_frontend_api "https://github.com/codingsk-dev/ai-bridge/blob/main/frontend/app/api/chat/message/route.ts"
click node_gateway "https://github.com/codingsk-dev/ai-bridge/blob/main/backend/src/app.ts"
click node_auth "https://github.com/codingsk-dev/ai-bridge/blob/main/backend/src/auth/services/auth.service.ts"
click node_business "https://github.com/codingsk-dev/ai-bridge/blob/main/backend/src/business/repositories/business.repository.ts"
click node_website "https://github.com/codingsk-dev/ai-bridge/blob/main/backend/src/website/services/website.service.ts"
click node_documents "https://github.com/codingsk-dev/ai-bridge/blob/main/backend/src/documents/services/document.service.ts"
click node_chat "https://github.com/codingsk-dev/ai-bridge/blob/main/backend/src/chat/services/chat.service.ts"
click node_jobs "https://github.com/codingsk-dev/ai-bridge/blob/main/backend/src/jobs/services/job.service.ts"
click node_analytics "https://github.com/codingsk-dev/ai-bridge/blob/main/backend/src/analytics/services/analytics.service.ts"
click node_ai_api "https://github.com/codingsk-dev/ai-bridge/blob/main/ai-service/app/api/router.py"
click node_crawler "https://github.com/codingsk-dev/ai-bridge/blob/main/ai-service/app/modules/analyze_website/crawler.py"
click node_document_processing "https://github.com/codingsk-dev/ai-bridge/blob/main/ai-service/app/modules/document_processing/service.py"
click node_chatbot "https://github.com/codingsk-dev/ai-bridge/blob/main/ai-service/app/modules/chatbot/service.py"
click node_live_research "https://github.com/codingsk-dev/ai-bridge/blob/main/ai-service/app/modules/live_research/service.py"
click node_reports "https://github.com/codingsk-dev/ai-bridge/tree/main/ai-service/app/modules/readiness_report"
click node_qdrant "https://github.com/codingsk-dev/ai-bridge/blob/main/ai-service/app/core/qdrant.py"
click node_postgres "https://github.com/codingsk-dev/ai-bridge/blob/main/backend/src/lib/prisma.ts"
click node_storage "https://github.com/codingsk-dev/ai-bridge/blob/main/backend/src/storage/supabase-storage.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_dashboard,node_embed,node_frontend_api toneBlue
class node_gateway,node_auth,node_business,node_website,node_documents,node_chat,node_jobs,node_analytics toneAmber
class node_ai_api,node_crawler,node_document_processing,node_chatbot,node_live_research,node_reports toneMint
class node_qdrant,node_postgres,node_storage toneRose
class node_owner,node_visitor toneIndigo
```

## Components

### Dashboard and Widget

- [Management Dashboard](https://github.com/codingsk-dev/ai-bridge/blob/main/frontend/app/dashboard/page.tsx): `frontend/app/dashboard/page.tsx`
- [Chat Widget](https://github.com/codingsk-dev/ai-bridge/blob/main/frontend/public/chatbot-widget.js): `frontend/public/chatbot-widget.js`
- [Frontend API Routes](https://github.com/codingsk-dev/ai-bridge/blob/main/frontend/app/api/chat/message/route.ts): `frontend/app/api/chat/message/route.ts`

### Backend Gateway

- [Express Gateway](https://github.com/codingsk-dev/ai-bridge/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [Authentication](https://github.com/codingsk-dev/ai-bridge/blob/main/backend/src/auth/services/auth.service.ts): `backend/src/auth/services/auth.service.ts`
- [Business Management](https://github.com/codingsk-dev/ai-bridge/blob/main/backend/src/business/repositories/business.repository.ts): `backend/src/business/repositories/business.repository.ts`
- [Website Ingestion](https://github.com/codingsk-dev/ai-bridge/blob/main/backend/src/website/services/website.service.ts): `backend/src/website/services/website.service.ts`
- [Document Upload](https://github.com/codingsk-dev/ai-bridge/blob/main/backend/src/documents/services/document.service.ts): `backend/src/documents/services/document.service.ts`
- [Chat Orchestration](https://github.com/codingsk-dev/ai-bridge/blob/main/backend/src/chat/services/chat.service.ts): `backend/src/chat/services/chat.service.ts`
- [Background Jobs](https://github.com/codingsk-dev/ai-bridge/blob/main/backend/src/jobs/services/job.service.ts): `backend/src/jobs/services/job.service.ts`
- [Analytics](https://github.com/codingsk-dev/ai-bridge/blob/main/backend/src/analytics/services/analytics.service.ts): `backend/src/analytics/services/analytics.service.ts`

### AI Service

- [AI API](https://github.com/codingsk-dev/ai-bridge/blob/main/ai-service/app/api/router.py): `ai-service/app/api/router.py`
- [Website Crawler](https://github.com/codingsk-dev/ai-bridge/blob/main/ai-service/app/modules/analyze_website/crawler.py): `ai-service/app/modules/analyze_website/crawler.py`
- [Document Processing](https://github.com/codingsk-dev/ai-bridge/blob/main/ai-service/app/modules/document_processing/service.py): `ai-service/app/modules/document_processing/service.py`
- [RAG Chat and Voice](https://github.com/codingsk-dev/ai-bridge/blob/main/ai-service/app/modules/chatbot/service.py): `ai-service/app/modules/chatbot/service.py`
- [Live Web Research](https://github.com/codingsk-dev/ai-bridge/blob/main/ai-service/app/modules/live_research/service.py): `ai-service/app/modules/live_research/service.py`
- [Readiness Reports](https://github.com/codingsk-dev/ai-bridge/tree/main/ai-service/app/modules/readiness_report): `ai-service/app/modules/readiness_report`

### Persistence and Integrations

- [Vector Index](https://github.com/codingsk-dev/ai-bridge/blob/main/ai-service/app/core/qdrant.py): `ai-service/app/core/qdrant.py`
- [Relational Database](https://github.com/codingsk-dev/ai-bridge/blob/main/backend/src/lib/prisma.ts): `backend/src/lib/prisma.ts`
- [Supabase Storage](https://github.com/codingsk-dev/ai-bridge/blob/main/backend/src/storage/supabase-storage.ts): `backend/src/storage/supabase-storage.ts`

### Other components

- **Business Owner**
- **Website Visitor**

## Connections

- Business Owner → Management Dashboard: configures
- Website Visitor → Chat Widget: chats through
- Management Dashboard → Frontend API Routes: requests
- Chat Widget → Frontend API Routes: sends messages
- Frontend API Routes → Express Gateway: proxies requests
- Express Gateway → Authentication: handles identity
- Express Gateway → Business Management: manages businesses
- Express Gateway → Website Ingestion: coordinates crawling
- Express Gateway → Document Upload: coordinates uploads
- Express Gateway → Chat Orchestration: orchestrates chat
- Express Gateway → Background Jobs: dispatches work
- Express Gateway → Analytics: persists history
- Express Gateway → Relational Database: persists records
- Document Upload → Supabase Storage: stores files (evidence: `backend/src/storage/supabase-storage.ts`)
- Express Gateway → AI API: proxies AI work
- AI API → Website Crawler: routes website analysis (evidence: `ai-service/app/api/router.py`)
- AI API → Document Processing: routes document processing (evidence: `ai-service/app/api/router.py`)
- AI API → RAG Chat and Voice: routes chat (evidence: `ai-service/app/api/router.py`)
- AI API → Live Web Research: routes research (evidence: `ai-service/app/api/router.py`)
- AI API → Readiness Reports: routes reports (evidence: `ai-service/app/api/router.py`)
- Website Crawler → Vector Index: indexes vectors
- Document Processing → Vector Index: indexes chunks
- RAG Chat and Voice → Vector Index: retrieves context
- RAG Chat and Voice → Live Web Research: augments answers
- RAG Chat and Voice → Website Visitor: returns answer
