# shuvam-11/bis-sahayak-ai architecture

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

- Interactive diagram: https://gitdiagram.com/shuvam-11/bis-sahayak-ai
- Repository: https://github.com/shuvam-11/bis-sahayak-ai

## Overview

#### Purpose and Entry Points

BIS Sahayak AI is a React/TypeScript assistant for navigating Indian Standards and BIS services. The browser app starts at `src/main.tsx`, renders the application shell in `src/App.tsx`, and is hosted through the Vite setup. A separate Node/Express backend entry point exists at `server.ts`, likely serving Gemini/RAG requests and keeping API credentials outside the browser.

#### Application Shell and Navigation

The UI is organized as a single application surface with navigation, hero content, dashboard-style actions, and footer:
- `src/App.tsx`
- `src/components/Navbar.tsx`
- `src/components/Dashboard.tsx`
- `src/components/Footer.tsx`

`Dashboard.tsx` and reusable `src/components/QuickActionCard.tsx` likely route users into specialized BIS assistance workflows rather than separate application deployments.

#### Conversational AI and Evidence Boundary

The core AI interaction is represented by:
- `src/components/ChatInterface.tsx`
- `src/services/ragEngine.ts`
- `src/components/SourcePanelDrawer.tsx`

The RAG engine is the central knowledge-retrieval boundary: it should retrieve BIS-grounded material before generating an answer. The source drawer exposes supporting references to the user. This implements the repository’s “Source or Refuse” principle: answer only when evidence is available, otherwise communicate lack of verified support.

#### Knowledge Corpus and Domain Types

The embedded BIS knowledge layer is defined by:
- `src/data/bisKnowledgeBase.ts`
- `src/types/index.ts`
- `src/components/AdminKnowledge.tsx`

`bisKnowledgeBase.ts` is the primary local/domain data source for retrieval and guided assistance. Shared types define contracts between UI, RAG processing, sources, and responses. `AdminKnowledge.tsx` is the likely management/inspection interface for knowledge content, making knowledge quality a distinct boundary from chat presentation.

#### Specialized BIS Workflows

Domain-specific assistant panels encapsulate major user journeys:
- `src/components/StandardFinder.tsx`
- `src/components/CertificationGuide.tsx`
- `src/components/TestingLabAssistant.tsx`
- `src/components/HallmarkingAssistant.tsx`
- `src/components/ConsumerHelp.tsx`

These components collect task-specific context and present tailored guidance for standards discovery, certification, laboratory/testing, hallmarking/HUID, and consumer concerns. They should converge on the same RAG/evidence flow rather than independently owning knowledge or model integration.

#### Trust, Localization, and Experience Controls

Trust and language concerns are first-class UI concerns:
- `src/components/ResponsibleAIModal.tsx`
- `src/i18n/translations.ts`
- `src/components/KnowledgeCore3D.tsx`

The responsible-AI modal communicates behavioral limits and provenance expectations. The translations module centralizes multilingual UI content. `KnowledgeCore3D.tsx`, alongside `src/components/HeroSection.tsx` and `src/components/HowItWorks.tsx`, provides explanatory/onboarding presentation around the knowledge system.

#### Runtime and External Dependencies

The frontend runs on React, TypeScript, and Vite (`src/main.tsx`, `vite.config.ts`); styling is described as Tailwind-based. The backend runtime is Node.js with Express (`server.ts`). Google Gemini is the external model service, accessed behind the server-side/RAG boundary. Deployment is intended for Vercel, while environment configuration is represented by `.env.example`.

Main entry points: [`src/services/ragEngine.ts`](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/services/ragEngine.ts) (RAG engine), [`src/App.tsx`](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/App.tsx) (Application shell), [`src/components/Dashboard.tsx`](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/Dashboard.tsx) (Dashboard actions), [`src/components/ChatInterface.tsx`](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/ChatInterface.tsx) (Chat interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Browser Application"]
  node_vite{{"Vite host<br/>frontend runtime<br/>[vite.config.ts]"}}
  node_main["Browser entry<br/>React bootstrap<br/>[main.tsx]"]
  node_app["Application shell<br/>React composition<br/>[App.tsx]"]
  node_navigation["Navigation &amp; footer<br/>shell UI<br/>[Navbar.tsx]"]
  node_dashboard["Dashboard actions<br/>workflow launcher<br/>[Dashboard.tsx]"]
  node_onboarding["Hero &amp; onboarding<br/>explanatory UI<br/>[HeroSection.tsx]"]
  node_chat["Chat interface<br/>conversational UI<br/>[ChatInterface.tsx]"]
  node_sources["Source drawer<br/>evidence UI"]
  node_trust["Responsible AI notice<br/>trust UI"]
  node_localization["Translations<br/>i18n content<br/>[translations.ts]"]
end

subgraph group_workflows["BIS Workflows"]
  node_standardfinder["Standard finder<br/>guided workflow<br/>[StandardFinder.tsx]"]
  node_certification["Certification guide<br/>guided workflow"]
  node_testing["Testing lab assistant<br/>guided workflow"]
  node_hallmarking["Hallmarking assistant<br/>guided workflow"]
  node_consumer["Consumer help<br/>guided workflow<br/>[ConsumerHelp.tsx]"]
end

subgraph group_knowledge["Knowledge &amp; Evidence"]
  node_rag{{"RAG engine<br/>retrieval boundary<br/>[ragEngine.ts]"}}
  node_corpus[("BIS knowledge base<br/>embedded corpus")]
  node_contracts["Shared domain types<br/>TypeScript contracts<br/>[index.ts]"]
  node_admin["Knowledge admin<br/>knowledge UI<br/>[AdminKnowledge.tsx]"]
end

subgraph group_backend["Server &amp; Model"]
  node_server["Express API<br/>Node backend<br/>[server.ts]"]
  node_gemini(("Google Gemini<br/>external model service"))
end

node_vite -->|"hosts"| node_main
node_main -->|"renders"| node_app
node_app -->|"composes"| node_navigation
node_app -->|"composes"| node_dashboard
node_app -->|"composes"| node_onboarding
node_app -->|"hosts"| node_chat
node_app -->|"presents"| node_trust
node_app -->|"uses"| node_localization
node_dashboard -->|"opens"| node_standardfinder
node_dashboard -->|"opens"| node_certification
node_dashboard -->|"opens"| node_testing
node_dashboard -->|"opens"| node_hallmarking
node_dashboard -->|"opens"| node_consumer
node_chat -->|"submits questions"| node_rag
node_standardfinder -->|"requests guidance"| node_rag
node_certification -->|"requests guidance"| node_rag
node_testing -->|"requests guidance"| node_rag
node_hallmarking -->|"requests guidance"| node_rag
node_consumer -->|"requests guidance"| node_rag
node_rag -->|"retrieves evidence"| node_corpus
node_rag -->|"uses contracts"| node_contracts
node_rag -->|"sends grounded requests"| node_server
node_server -->|"invokes"| node_gemini
node_chat -->|"shows citations"| node_sources
node_admin -->|"inspects knowledge"| node_corpus

click node_vite "https://github.com/shuvam-11/bis-sahayak-ai/blob/main/vite.config.ts"
click node_main "https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/main.tsx"
click node_app "https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/App.tsx"
click node_navigation "https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/Navbar.tsx"
click node_dashboard "https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/Dashboard.tsx"
click node_onboarding "https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/HeroSection.tsx"
click node_chat "https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/ChatInterface.tsx"
click node_sources "https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/SourcePanelDrawer.tsx"
click node_trust "https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/ResponsibleAIModal.tsx"
click node_localization "https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/i18n/translations.ts"
click node_standardfinder "https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/StandardFinder.tsx"
click node_certification "https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/CertificationGuide.tsx"
click node_testing "https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/TestingLabAssistant.tsx"
click node_hallmarking "https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/HallmarkingAssistant.tsx"
click node_consumer "https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/ConsumerHelp.tsx"
click node_rag "https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/services/ragEngine.ts"
click node_corpus "https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/data/bisKnowledgeBase.ts"
click node_contracts "https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/types/index.ts"
click node_admin "https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/AdminKnowledge.tsx"
click node_server "https://github.com/shuvam-11/bis-sahayak-ai/blob/main/server.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_vite,node_main,node_app,node_navigation,node_dashboard,node_onboarding,node_chat,node_sources,node_trust,node_localization toneBlue
class node_standardfinder,node_certification,node_testing,node_hallmarking,node_consumer toneAmber
class node_rag,node_corpus,node_contracts,node_admin toneMint
class node_server,node_gemini toneRose
```

## Components

### Browser Application

- [Vite host](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/vite.config.ts): frontend runtime · `vite.config.ts`
- [Browser entry](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/main.tsx): React bootstrap · `src/main.tsx`
- [Application shell](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/App.tsx): React composition · `src/App.tsx`
- [Navigation & footer](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/Navbar.tsx): shell UI · `src/components/Navbar.tsx`
- [Dashboard actions](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/Dashboard.tsx): workflow launcher · `src/components/Dashboard.tsx`
- [Hero & onboarding](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/HeroSection.tsx): explanatory UI · `src/components/HeroSection.tsx`
- [Chat interface](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/ChatInterface.tsx): conversational UI · `src/components/ChatInterface.tsx`
- [Source drawer](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/SourcePanelDrawer.tsx): evidence UI · Shows supporting references for answers. · `src/components/SourcePanelDrawer.tsx`
- [Responsible AI notice](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/ResponsibleAIModal.tsx): trust UI · `src/components/ResponsibleAIModal.tsx`
- [Translations](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/i18n/translations.ts): i18n content · `src/i18n/translations.ts`

### BIS Workflows

- [Standard finder](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/StandardFinder.tsx): guided workflow · `src/components/StandardFinder.tsx`
- [Certification guide](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/CertificationGuide.tsx): guided workflow · `src/components/CertificationGuide.tsx`
- [Testing lab assistant](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/TestingLabAssistant.tsx): guided workflow · `src/components/TestingLabAssistant.tsx`
- [Hallmarking assistant](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/HallmarkingAssistant.tsx): guided workflow · `src/components/HallmarkingAssistant.tsx`
- [Consumer help](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/ConsumerHelp.tsx): guided workflow · `src/components/ConsumerHelp.tsx`

### Knowledge & Evidence

- [RAG engine](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/services/ragEngine.ts): retrieval boundary · Retrieves evidence before answering or refuses when unsupported. · `src/services/ragEngine.ts`
- [BIS knowledge base](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/data/bisKnowledgeBase.ts): embedded corpus · `src/data/bisKnowledgeBase.ts`
- [Shared domain types](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/types/index.ts): TypeScript contracts · `src/types/index.ts`
- [Knowledge admin](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/src/components/AdminKnowledge.tsx): knowledge UI · `src/components/AdminKnowledge.tsx`

### Server & Model

- [Express API](https://github.com/shuvam-11/bis-sahayak-ai/blob/main/server.ts): Node backend · Keeps model credentials outside the browser. · `server.ts`
- **Google Gemini**: external model service

## Connections

- Vite host → Browser entry: hosts
- Browser entry → Application shell: renders
- Application shell → Navigation & footer: composes
- Application shell → Dashboard actions: composes
- Application shell → Hero & onboarding: composes
- Application shell → Chat interface: hosts
- Application shell → Responsible AI notice: presents
- Application shell → Translations: uses
- Dashboard actions → Standard finder: opens
- Dashboard actions → Certification guide: opens
- Dashboard actions → Testing lab assistant: opens
- Dashboard actions → Hallmarking assistant: opens
- Dashboard actions → Consumer help: opens
- Chat interface → RAG engine: submits questions
- Standard finder → RAG engine: requests guidance
- Certification guide → RAG engine: requests guidance
- Testing lab assistant → RAG engine: requests guidance
- Hallmarking assistant → RAG engine: requests guidance
- Consumer help → RAG engine: requests guidance
- RAG engine → BIS knowledge base: retrieves evidence
- RAG engine → Shared domain types: uses contracts
- RAG engine → Express API: sends grounded requests
- Express API → Google Gemini: invokes
- Chat interface → Source drawer: shows citations
- Knowledge admin → BIS knowledge base: inspects knowledge
