# ashmitkmishra/codelinc-dental architecture

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

- Interactive diagram: https://gitdiagram.com/ashmitkmishra/codelinc-dental
- Repository: https://github.com/ashmitkmishra/codelinc-dental

## Overview

Floss helps employees understand dental coverage, estimate treatment costs, and time care around benefit resets through a web app and WhatsApp. The web workflow is sign-in, chat or review member details, then receive answers from the API; WhatsApp messages enter a separate bot path that can call the same RAG function. The RAG handler retrieves member-specific records, and the advisor selects treatments, builds verified facts, and writes an answer. The README documents the major flows; some backend and UI links are documented rather than visible in sampled implementation excerpts.

Main entry points: [`backend/rag/handler.py`](https://github.com/ashmitkmishra/codelinc-dental/blob/main/backend/rag/handler.py) (API Lambda), [`apps/web/src/app/router.tsx`](https://github.com/ashmitkmishra/codelinc-dental/blob/main/apps/web/src/app/router.tsx) (App routing), [`backend/whatsapp-chatbot/bot.py`](https://github.com/ashmitkmishra/codelinc-dental/blob/main/backend/whatsapp-chatbot/bot.py) (Message handling), [`apps/web/src/lib/api/FlossApi.ts`](https://github.com/ashmitkmishra/codelinc-dental/blob/main/apps/web/src/lib/api/FlossApi.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web app"]
  node_webapp["Web application<br/>[App.tsx]"]
  node_routing["App routing<br/>[router.tsx]"]
  node_auth["Sign-in<br/>[Auth.tsx]"]
  node_chat["Chat experience<br/>[Chat.tsx]"]
  node_overview["Member overview<br/>[OverviewPanels.tsx]"]
  node_api_client["API client<br/>[FlossApi.ts]"]
end

subgraph group_contracts["Shared contract"]
  node_schemas["API schemas<br/>[schemas.ts]"]
  node_plans["Plan fixtures<br/>[plans.ts]"]
end

subgraph group_rag["API and RAG"]
  node_handler["API Lambda<br/>[handler.py]"]
  node_advisor["RAG advisor<br/>[advisor.py]"]
end

subgraph group_whatsapp["WhatsApp bot"]
  node_lambda["Bot Lambda<br/>[lambda_function.py]"]
  node_bot["Message handling<br/>[bot.py]"]
  node_floss["RAG bridge<br/>[floss.py]"]
  node_history["Bot conversation history<br/>[history.py]"]
  node_bot_bedrock["Bot model client<br/>[bedrock.py]"]
end

subgraph group_services["Data and services"]
  node_database[("Postgres and pgvector")]
  node_cognito["Amazon Cognito"]
  node_bedrock["Amazon Bedrock"]
  node_twilio["Twilio WhatsApp"]
end

node_employee(("Employee"))

node_employee -->|"uses"| node_webapp
node_webapp -->|"renders routes"| node_routing
node_routing -->|"routes to"| node_auth
node_routing -->|"routes to"| node_chat
node_routing -->|"routes to"| node_overview
node_auth -->|"authenticates with"| node_cognito
node_chat -->|"uses"| node_api_client
node_api_client -->|"calls API"| node_handler
node_api_client -->|"uses shapes"| node_schemas
node_handler -->|"checks verified claims"| node_cognito
node_handler -->|"reads and writes"| node_database
node_handler -->|"invokes"| node_advisor
node_handler -->|"uses for language work"| node_bedrock
node_handler -->|"serves contract"| node_schemas
node_employee -->|"messages"| node_twilio
node_twilio -->|"delivers webhook"| node_lambda
node_lambda -->|"dispatches to"| node_bot
node_bot -->|"requests member answers"| node_floss
node_bot -->|"replays and saves turns"| node_history
node_bot -->|"uses fallback"| node_bot_bedrock
node_floss -->|"invokes RAG"| node_handler
node_plans -->|"uses plan types"| node_schemas

click node_webapp "https://github.com/ashmitkmishra/codelinc-dental/blob/main/apps/web/src/app/App.tsx"
click node_routing "https://github.com/ashmitkmishra/codelinc-dental/blob/main/apps/web/src/app/router.tsx"
click node_auth "https://github.com/ashmitkmishra/codelinc-dental/blob/main/apps/web/src/pages/Auth.tsx"
click node_chat "https://github.com/ashmitkmishra/codelinc-dental/blob/main/apps/web/src/pages/app/Chat.tsx"
click node_overview "https://github.com/ashmitkmishra/codelinc-dental/blob/main/apps/web/src/components/floss/OverviewPanels.tsx"
click node_api_client "https://github.com/ashmitkmishra/codelinc-dental/blob/main/apps/web/src/lib/api/FlossApi.ts"
click node_schemas "https://github.com/ashmitkmishra/codelinc-dental/blob/main/packages/contracts/src/schemas.ts"
click node_plans "https://github.com/ashmitkmishra/codelinc-dental/blob/main/packages/contracts/src/plans.ts"
click node_handler "https://github.com/ashmitkmishra/codelinc-dental/blob/main/backend/rag/handler.py"
click node_advisor "https://github.com/ashmitkmishra/codelinc-dental/blob/main/backend/rag/advisor.py"
click node_lambda "https://github.com/ashmitkmishra/codelinc-dental/blob/main/backend/whatsapp-chatbot/lambda_function.py"
click node_bot "https://github.com/ashmitkmishra/codelinc-dental/blob/main/backend/whatsapp-chatbot/bot.py"
click node_floss "https://github.com/ashmitkmishra/codelinc-dental/blob/main/backend/whatsapp-chatbot/floss.py"
click node_history "https://github.com/ashmitkmishra/codelinc-dental/blob/main/backend/whatsapp-chatbot/history.py"
click node_bot_bedrock "https://github.com/ashmitkmishra/codelinc-dental/blob/main/backend/whatsapp-chatbot/bedrock.py"

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_webapp,node_routing,node_auth,node_chat,node_overview,node_api_client toneBlue
class node_schemas,node_plans toneAmber
class node_handler,node_advisor toneMint
class node_lambda,node_bot,node_floss,node_history,node_bot_bedrock toneRose
class node_database,node_cognito,node_bedrock,node_twilio,node_employee toneIndigo
```

## Components

### Web app

- [Web application](https://github.com/ashmitkmishra/codelinc-dental/blob/main/apps/web/src/app/App.tsx): `apps/web/src/app/App.tsx`
- [App routing](https://github.com/ashmitkmishra/codelinc-dental/blob/main/apps/web/src/app/router.tsx): `apps/web/src/app/router.tsx`
- [Sign-in](https://github.com/ashmitkmishra/codelinc-dental/blob/main/apps/web/src/pages/Auth.tsx): `apps/web/src/pages/Auth.tsx`
- [Chat experience](https://github.com/ashmitkmishra/codelinc-dental/blob/main/apps/web/src/pages/app/Chat.tsx): `apps/web/src/pages/app/Chat.tsx`
- [Member overview](https://github.com/ashmitkmishra/codelinc-dental/blob/main/apps/web/src/components/floss/OverviewPanels.tsx): `apps/web/src/components/floss/OverviewPanels.tsx`
- [API client](https://github.com/ashmitkmishra/codelinc-dental/blob/main/apps/web/src/lib/api/FlossApi.ts): `apps/web/src/lib/api/FlossApi.ts`

### Shared contract

- [API schemas](https://github.com/ashmitkmishra/codelinc-dental/blob/main/packages/contracts/src/schemas.ts): `packages/contracts/src/schemas.ts`
- [Plan fixtures](https://github.com/ashmitkmishra/codelinc-dental/blob/main/packages/contracts/src/plans.ts): `packages/contracts/src/plans.ts`

### API and RAG

- [API Lambda](https://github.com/ashmitkmishra/codelinc-dental/blob/main/backend/rag/handler.py): `backend/rag/handler.py`
- [RAG advisor](https://github.com/ashmitkmishra/codelinc-dental/blob/main/backend/rag/advisor.py): `backend/rag/advisor.py`

### WhatsApp bot

- [Bot Lambda](https://github.com/ashmitkmishra/codelinc-dental/blob/main/backend/whatsapp-chatbot/lambda_function.py): `backend/whatsapp-chatbot/lambda_function.py`
- [Message handling](https://github.com/ashmitkmishra/codelinc-dental/blob/main/backend/whatsapp-chatbot/bot.py): `backend/whatsapp-chatbot/bot.py`
- [RAG bridge](https://github.com/ashmitkmishra/codelinc-dental/blob/main/backend/whatsapp-chatbot/floss.py): `backend/whatsapp-chatbot/floss.py`
- [Bot conversation history](https://github.com/ashmitkmishra/codelinc-dental/blob/main/backend/whatsapp-chatbot/history.py): `backend/whatsapp-chatbot/history.py`
- [Bot model client](https://github.com/ashmitkmishra/codelinc-dental/blob/main/backend/whatsapp-chatbot/bedrock.py): `backend/whatsapp-chatbot/bedrock.py`

### Data and services

- **Postgres and pgvector**
- **Amazon Cognito**
- **Amazon Bedrock**
- **Twilio WhatsApp**

### Other components

- **Employee**

## Connections

- Employee → Web application: uses (evidence: `README.md`)
- Web application → App routing: renders routes (evidence: `apps/web/src/app/App.tsx`)
- App routing → Sign-in: routes to (evidence: `apps/web/src/app/router.tsx`)
- App routing → Chat experience: routes to (evidence: `apps/web/src/app/router.tsx`)
- App routing → Member overview: routes to (evidence: `apps/web/src/app/router.tsx`)
- Sign-in → Amazon Cognito: authenticates with (evidence: `README.md`)
- Chat experience → API client: uses (evidence: `apps/web/src/pages/app/Chat.tsx`)
- API client → API Lambda: calls API (evidence: `README.md`)
- API client → API schemas: uses shapes (evidence: `apps/web/src/lib/api/FlossApi.ts`)
- API Lambda → Amazon Cognito: checks verified claims (evidence: `README.md`)
- API Lambda → Postgres and pgvector: reads and writes (evidence: `backend/rag/handler.py`)
- API Lambda → RAG advisor: invokes (evidence: `backend/rag/handler.py`)
- API Lambda → Amazon Bedrock: uses for language work (evidence: `README.md`)
- API Lambda → API schemas: serves contract (evidence: `README.md`)
- Employee → Twilio WhatsApp: messages (evidence: `README.md`)
- Twilio WhatsApp → Bot Lambda: delivers webhook (evidence: `README.md`)
- Bot Lambda → Message handling: dispatches to (evidence: `backend/whatsapp-chatbot/lambda_function.py`)
- Message handling → RAG bridge: requests member answers (evidence: `backend/whatsapp-chatbot/bot.py`)
- Message handling → Bot conversation history: replays and saves turns (evidence: `backend/whatsapp-chatbot/bot.py`)
- Message handling → Bot model client: uses fallback (evidence: `backend/whatsapp-chatbot/bot.py`)
- RAG bridge → API Lambda: invokes RAG (evidence: `README.md`)
- Plan fixtures → API schemas: uses plan types (evidence: `packages/contracts/src/plans.ts`)
