# divyasree-7/smart-bharat-ai architecture

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

- Interactive diagram: https://gitdiagram.com/divyasree-7/smart-bharat-ai
- Repository: https://github.com/divyasree-7/smart-bharat-ai

## Overview

Smart Bharat AI is a browser-based civic guidance assistant. Citizens can ask general questions, get profile-based scheme suggestions, or generate complaint drafts; each AI workflow sends a prompt to Groq and presents its response in the UI. Login/profile settings and theme preferences are client-side. The graph preserves the documented informational capabilities, but unsampled pages are represented only where the README or SOURCE INDEX supports them.

Main entry points: [`src/App.jsx`](https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/App.jsx) (App routes), [`src/context/AuthContext.jsx`](https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/context/AuthContext.jsx) (Auth and key state), [`src/components/ChakraWheel.jsx`](https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/components/ChakraWheel.jsx) (Chakra visual), [`src/services/groqService.js`](https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/services/groqService.js) (Prompt and API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Civic experience"]
  node_main["Application entry<br/>[main.jsx]"]
  node_app["App routes<br/>[App.jsx]"]
  node_home["Home<br/>[Home.jsx]"]
  node_login["Login<br/>[Login.jsx]"]
  node_profile["Profile settings<br/>[Profile.jsx]"]
  node_about["About<br/>[About.jsx]"]
  node_notfound["Not found<br/>[NotFound.jsx]"]
end

subgraph group_guidance["AI guidance"]
  node_chat["Assistant chat<br/>[Chat.jsx]"]
  node_schemes["Scheme finder<br/>[Schemes.jsx]"]
  node_complaint["Complaint assistant<br/>[Complaint.jsx]"]
  node_groqservice["Prompt and API client<br/>[groqService.js]"]
end

subgraph group_state["Browser state"]
  node_auth["Auth and key state<br/>[AuthContext.jsx]"]
  node_authstorage[("Browser local storage")]
  node_theme["Theme state<br/>[ThemeContext.jsx]"]
  node_themedata[("Theme preference")]
end

subgraph group_shared["Shared UI"]
  node_navbar["Navigation bar<br/>[Navbar.jsx]"]
  node_footer["Footer<br/>[Footer.jsx]"]
  node_chatmessage["Chat responses<br/>[ChatMessage.jsx]"]
  node_chakra["Chakra visual<br/>[ChakraWheel.jsx]"]
end

node_citizen(("Citizen"))
node_groq["Groq chat API"]

node_citizen -->|"opens app"| node_app
node_app -->|"renders"| node_navbar
node_app -->|"renders"| node_footer
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_chat
node_app -->|"routes to"| node_schemes
node_app -->|"routes to"| node_complaint
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_profile
node_app -->|"routes to"| node_about
node_app -->|"routes to"| node_notfound
node_chat -->|"requests guidance"| node_groqservice
node_schemes -->|"requests recommendations"| node_groqservice
node_complaint -->|"requests draft"| node_groqservice
node_groqservice -->|"posts completion"| node_groq
node_groq -->|"returns response"| node_groqservice
node_chat -->|"uses API key"| node_auth
node_schemes -->|"uses API key"| node_auth
node_complaint -->|"uses API key"| node_auth
node_auth -->|"reads and writes"| node_authstorage
node_login -->|"uses login state"| node_auth
node_profile -->|"manages profile"| node_auth
node_theme -->|"reads and writes"| node_themedata
node_navbar -->|"uses user state"| node_auth
node_navbar -->|"toggles theme"| node_theme
node_chat -->|"renders messages"| node_chatmessage
node_schemes -->|"renders result"| node_chatmessage
node_complaint -->|"renders result"| node_chatmessage
node_chatmessage -->|"renders motif"| node_chakra
node_navbar -->|"renders motif"| node_chakra
node_home -->|"renders motif"| node_chakra
node_footer -->|"uses motif"| node_chakra
node_about -->|"uses motif"| node_chakra
node_login -->|"uses motif"| node_chakra
node_profile -->|"uses motif"| node_chakra
node_notfound -->|"uses motif"| node_chakra
node_main -->|"mounts"| node_app
node_main -->|"provides state"| node_auth
node_main -->|"provides state"| node_theme

click node_main "https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/main.jsx"
click node_app "https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/App.jsx"
click node_home "https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/pages/Home.jsx"
click node_chat "https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/pages/Chat.jsx"
click node_schemes "https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/pages/Schemes.jsx"
click node_complaint "https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/pages/Complaint.jsx"
click node_login "https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/pages/Login.jsx"
click node_profile "https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/pages/Profile.jsx"
click node_about "https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/pages/About.jsx"
click node_notfound "https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/pages/NotFound.jsx"
click node_groqservice "https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/services/groqService.js"
click node_auth "https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/context/AuthContext.jsx"
click node_theme "https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/context/ThemeContext.jsx"
click node_navbar "https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/components/Navbar.jsx"
click node_footer "https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/components/Footer.jsx"
click node_chatmessage "https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/components/ChatMessage.jsx"
click node_chakra "https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/components/ChakraWheel.jsx"

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_main,node_app,node_home,node_login,node_profile,node_about,node_notfound toneBlue
class node_chat,node_schemes,node_complaint,node_groqservice toneAmber
class node_auth,node_authstorage,node_theme,node_themedata,node_groq toneMint
class node_navbar,node_footer,node_chatmessage,node_chakra toneRose
class node_citizen toneIndigo
```

## Components

### Civic experience

- [Application entry](https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/main.jsx): `src/main.jsx`
- [App routes](https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/App.jsx): `src/App.jsx`
- [Home](https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/pages/Home.jsx): `src/pages/Home.jsx`
- [Login](https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/pages/Login.jsx): `src/pages/Login.jsx`
- [Profile settings](https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/pages/Profile.jsx): `src/pages/Profile.jsx`
- [About](https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/pages/About.jsx): `src/pages/About.jsx`
- [Not found](https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/pages/NotFound.jsx): `src/pages/NotFound.jsx`

### AI guidance

- [Assistant chat](https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/pages/Chat.jsx): `src/pages/Chat.jsx`
- [Scheme finder](https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/pages/Schemes.jsx): `src/pages/Schemes.jsx`
- [Complaint assistant](https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/pages/Complaint.jsx): `src/pages/Complaint.jsx`
- [Prompt and API client](https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/services/groqService.js): `src/services/groqService.js`

### Browser state

- [Auth and key state](https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/context/AuthContext.jsx): `src/context/AuthContext.jsx`
- **Browser local storage**
- [Theme state](https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/context/ThemeContext.jsx): `src/context/ThemeContext.jsx`
- **Theme preference**

### Shared UI

- [Navigation bar](https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/components/Navbar.jsx): `src/components/Navbar.jsx`
- [Footer](https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/components/Footer.jsx): `src/components/Footer.jsx`
- [Chat responses](https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/components/ChatMessage.jsx): `src/components/ChatMessage.jsx`
- [Chakra visual](https://github.com/divyasree-7/smart-bharat-ai/blob/main/src/components/ChakraWheel.jsx): `src/components/ChakraWheel.jsx`

### Other components

- **Citizen**
- **Groq chat API**

## Connections

- Citizen → App routes: opens app (evidence: `src/App.jsx`)
- App routes → Navigation bar: renders (evidence: `src/App.jsx`)
- App routes → Footer: renders (evidence: `src/App.jsx`)
- App routes → Home: routes to (evidence: `src/App.jsx`)
- App routes → Assistant chat: routes to (evidence: `src/App.jsx`)
- App routes → Scheme finder: routes to (evidence: `src/App.jsx`)
- App routes → Complaint assistant: routes to (evidence: `src/App.jsx`)
- App routes → Login: routes to (evidence: `src/App.jsx`)
- App routes → Profile settings: routes to (evidence: `src/App.jsx`)
- App routes → About: routes to (evidence: `src/App.jsx`)
- App routes → Not found: routes to (evidence: `src/App.jsx`)
- Assistant chat → Prompt and API client: requests guidance (evidence: `src/pages/Chat.jsx`)
- Scheme finder → Prompt and API client: requests recommendations (evidence: `src/pages/Schemes.jsx`)
- Complaint assistant → Prompt and API client: requests draft (evidence: `src/pages/Complaint.jsx`)
- Prompt and API client → Groq chat API: posts completion (evidence: `src/services/groqService.js`)
- Groq chat API → Prompt and API client: returns response (evidence: `src/services/groqService.js`)
- Assistant chat → Auth and key state: uses API key (evidence: `src/pages/Chat.jsx`)
- Scheme finder → Auth and key state: uses API key (evidence: `src/pages/Schemes.jsx`)
- Complaint assistant → Auth and key state: uses API key (evidence: `src/pages/Complaint.jsx`)
- Auth and key state → Browser local storage: reads and writes (evidence: `src/context/AuthContext.jsx`)
- Login → Auth and key state: uses login state (evidence: `src/pages/Login.jsx`)
- Profile settings → Auth and key state: manages profile (evidence: `src/pages/Profile.jsx`)
- Theme state → Theme preference: reads and writes (evidence: `src/context/ThemeContext.jsx`)
- Navigation bar → Auth and key state: uses user state (evidence: `src/components/Navbar.jsx`)
- Navigation bar → Theme state: toggles theme (evidence: `src/components/Navbar.jsx`)
- Assistant chat → Chat responses: renders messages (evidence: `src/pages/Chat.jsx`)
- Scheme finder → Chat responses: renders result (evidence: `src/pages/Schemes.jsx`)
- Complaint assistant → Chat responses: renders result (evidence: `src/pages/Complaint.jsx`)
- Chat responses → Chakra visual: renders motif (evidence: `src/components/ChatMessage.jsx`)
- Navigation bar → Chakra visual: renders motif (evidence: `src/components/Navbar.jsx`)
- Home → Chakra visual: renders motif (evidence: `src/pages/Home.jsx`)
- Footer → Chakra visual: uses motif (evidence: `src/components/Footer.jsx`)
- About → Chakra visual: uses motif (evidence: `src/pages/About.jsx`)
- Login → Chakra visual: uses motif (evidence: `src/pages/Login.jsx`)
- Profile settings → Chakra visual: uses motif (evidence: `src/pages/Profile.jsx`)
- Not found → Chakra visual: uses motif (evidence: `src/pages/NotFound.jsx`)
- Application entry → App routes: mounts (evidence: `src/main.jsx`)
- Application entry → Auth and key state: provides state (evidence: `src/main.jsx`)
- Application entry → Theme state: provides state (evidence: `src/main.jsx`)
