# akhil9944/ai-personal-assistant---chrome-extension architecture

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

- Interactive diagram: https://gitdiagram.com/akhil9944/ai-personal-assistant---chrome-extension
- Repository: https://github.com/akhil9944/ai-personal-assistant---chrome-extension

## Overview

Personal AI Assistant is a Chrome side-panel chat that captures a browser tab or desktop, sends the prompt and image to a FastAPI service, streams a grounded Gemini response, and persists conversation history in Supabase. The graph follows the documented and excerpted request path; README-described features such as model selection, Markdown rendering, and session history are retained. Backend and extension source excerpts provide call evidence; external service relationships are also documented in the README.

Main entry points: [`extension/src/App.jsx`](https://github.com/akhil9944/ai-personal-assistant---chrome-extension/blob/main/extension/src/App.jsx) (Side panel app), [`backend/app/api/chat.py`](https://github.com/akhil9944/ai-personal-assistant---chrome-extension/blob/main/backend/app/api/chat.py) (Chat and session routes), [`extension/src/services/api.js`](https://github.com/akhil9944/ai-personal-assistant---chrome-extension/blob/main/extension/src/services/api.js) (Backend client), [`extension/src/services/screenCapture.js`](https://github.com/akhil9944/ai-personal-assistant---chrome-extension/blob/main/extension/src/services/screenCapture.js) (Capture engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Screen capture"]
  node_capture_engine["Capture engine<br/>[screenCapture.js]"]
end

subgraph group_extension["Chrome assistant"]
  node_side_panel["Side panel app<br/>[App.jsx]"]
  node_preview["Screenshot preview<br/>[ScreenPreview.jsx]"]
  node_message_view["Chat renderer<br/>[ChatMessage.jsx]"]
  node_extension_api["Backend client<br/>[api.js]"]
end

subgraph group_backend["API and orchestration"]
  node_fastapi["FastAPI entry point<br/>[main.py]"]
  node_chat_api["Chat and session routes<br/>[chat.py]"]
end

subgraph group_ai["Vision reasoning"]
  node_gemini_service["Gemini stream service<br/>[gemini_service.py]"]
end

subgraph group_persistence["Conversation storage"]
  node_supabase_client["Supabase operations<br/>[supabase_client.py]"]
end

node_user(("User"))
node_screen["Browser or desktop screen"]
node_gemini["Google Gemini"]
node_supabase[("Supabase PostgreSQL")]

node_user -->|"asks questions"| node_side_panel
node_screen -->|"provides pixels"| node_capture_engine
node_side_panel -->|"requests capture"| node_capture_engine
node_capture_engine -->|"returns screenshot"| node_side_panel
node_side_panel -->|"renders attachment"| node_preview
node_side_panel -->|"renders messages"| node_message_view
node_side_panel -->|"sends prompt"| node_extension_api
node_extension_api -->|"checks health"| node_fastapi
node_extension_api -->|"posts chat"| node_chat_api
node_fastapi -->|"mounts routes"| node_chat_api
node_chat_api -->|"streams request"| node_gemini_service
node_gemini_service -->|"requests vision stream"| node_gemini
node_chat_api -->|"saves and reads history"| node_supabase_client
node_supabase_client -->|"queries tables"| node_supabase
node_chat_api -->|"streams response"| node_extension_api

click node_capture_engine "https://github.com/akhil9944/ai-personal-assistant---chrome-extension/blob/main/extension/src/services/screenCapture.js"
click node_side_panel "https://github.com/akhil9944/ai-personal-assistant---chrome-extension/blob/main/extension/src/App.jsx"
click node_preview "https://github.com/akhil9944/ai-personal-assistant---chrome-extension/blob/main/extension/src/components/ScreenPreview.jsx"
click node_message_view "https://github.com/akhil9944/ai-personal-assistant---chrome-extension/blob/main/extension/src/components/ChatMessage.jsx"
click node_extension_api "https://github.com/akhil9944/ai-personal-assistant---chrome-extension/blob/main/extension/src/services/api.js"
click node_fastapi "https://github.com/akhil9944/ai-personal-assistant---chrome-extension/blob/main/backend/app/main.py"
click node_chat_api "https://github.com/akhil9944/ai-personal-assistant---chrome-extension/blob/main/backend/app/api/chat.py"
click node_gemini_service "https://github.com/akhil9944/ai-personal-assistant---chrome-extension/blob/main/backend/app/services/gemini_service.py"
click node_supabase_client "https://github.com/akhil9944/ai-personal-assistant---chrome-extension/blob/main/backend/app/db/supabase_client.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_capture_engine,node_user,node_screen toneBlue
class node_side_panel,node_preview,node_message_view,node_extension_api,node_supabase toneAmber
class node_fastapi,node_chat_api toneMint
class node_gemini_service toneRose
class node_supabase_client,node_gemini toneIndigo
```

## Components

### Screen capture

- [Capture engine](https://github.com/akhil9944/ai-personal-assistant---chrome-extension/blob/main/extension/src/services/screenCapture.js): `extension/src/services/screenCapture.js`

### Chrome assistant

- [Side panel app](https://github.com/akhil9944/ai-personal-assistant---chrome-extension/blob/main/extension/src/App.jsx): `extension/src/App.jsx`
- [Screenshot preview](https://github.com/akhil9944/ai-personal-assistant---chrome-extension/blob/main/extension/src/components/ScreenPreview.jsx): `extension/src/components/ScreenPreview.jsx`
- [Chat renderer](https://github.com/akhil9944/ai-personal-assistant---chrome-extension/blob/main/extension/src/components/ChatMessage.jsx): `extension/src/components/ChatMessage.jsx`
- [Backend client](https://github.com/akhil9944/ai-personal-assistant---chrome-extension/blob/main/extension/src/services/api.js): `extension/src/services/api.js`

### API and orchestration

- [FastAPI entry point](https://github.com/akhil9944/ai-personal-assistant---chrome-extension/blob/main/backend/app/main.py): `backend/app/main.py`
- [Chat and session routes](https://github.com/akhil9944/ai-personal-assistant---chrome-extension/blob/main/backend/app/api/chat.py): `backend/app/api/chat.py`

### Vision reasoning

- [Gemini stream service](https://github.com/akhil9944/ai-personal-assistant---chrome-extension/blob/main/backend/app/services/gemini_service.py): `backend/app/services/gemini_service.py`

### Conversation storage

- [Supabase operations](https://github.com/akhil9944/ai-personal-assistant---chrome-extension/blob/main/backend/app/db/supabase_client.py): `backend/app/db/supabase_client.py`

### Other components

- **User**
- **Browser or desktop screen**
- **Google Gemini**
- **Supabase PostgreSQL**

## Connections

- User → Side panel app: asks questions (evidence: `README.md`)
- Browser or desktop screen → Capture engine: provides pixels (evidence: `README.md`)
- Side panel app → Capture engine: requests capture (evidence: `extension/src/App.jsx`)
- Capture engine → Side panel app: returns screenshot (evidence: `extension/src/App.jsx`)
- Side panel app → Screenshot preview: renders attachment (evidence: `extension/src/App.jsx`)
- Side panel app → Chat renderer: renders messages (evidence: `extension/src/App.jsx`)
- Side panel app → Backend client: sends prompt (evidence: `extension/src/App.jsx`)
- Backend client → FastAPI entry point: checks health (evidence: `extension/src/services/api.js`)
- Backend client → Chat and session routes: posts chat (evidence: `README.md`)
- FastAPI entry point → Chat and session routes: mounts routes (evidence: `backend/app/main.py`)
- Chat and session routes → Gemini stream service: streams request (evidence: `backend/app/api/chat.py`)
- Gemini stream service → Google Gemini: requests vision stream (evidence: `README.md`)
- Chat and session routes → Supabase operations: saves and reads history (evidence: `backend/app/api/chat.py`)
- Supabase operations → Supabase PostgreSQL: queries tables (evidence: `README.md`)
- Chat and session routes → Backend client: streams response (evidence: `README.md`)
