# abrar822/friday_ai architecture

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

- Interactive diagram: https://gitdiagram.com/abrar822/friday_ai
- Repository: https://github.com/abrar822/friday_ai

## Overview

Friday is a desktop AI assistant: the user chats or dictates a request, the backend interprets it into tasks, executes assistant actions, and returns text with spoken feedback. The frontend also exposes memory-location management, settings, and a PDF retrieval mode. The graph preserves those documented routes and sampled UI flows; several backend modules are listed in the source index but were not excerpted, so links into them are shown only where main.py explicitly registers or initializes them.

Main entry points: [`backend/main.py`](https://github.com/abrar822/friday_ai/blob/main/backend/main.py) (FastAPI app), [`frontend/src/App.jsx`](https://github.com/abrar822/friday_ai/blob/main/frontend/src/App.jsx) (App shell), [`backend/core/llm_prompt_endpoint.py`](https://github.com/abrar822/friday_ai/blob/main/backend/core/llm_prompt_endpoint.py) (Prompt endpoint), [`frontend/src/config/api.js`](https://github.com/abrar822/friday_ai/blob/main/frontend/src/config/api.js) (API base config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Desktop client"]
  node_app["App shell<br/>[App.jsx]"]
  node_chat["Chat and modes<br/>[Chatbox.jsx]"]
  node_memory_ui["Memory manager<br/>[Memory.jsx]"]
  node_settings_ui["Settings page<br/>[Settings.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_memory_client["Memory API client<br/>[MemoryConnect.js]"]
  node_chat_client["Chat API client<br/>[FastapiConnect.js]"]
  node_pdf_client["PDF API client"]
  node_settings_client["Settings API client<br/>[setting_api.js]"]
  node_stt_client["Speech API client<br/>[sttConnect.js]"]
  node_api_config["API base config<br/>[api.js]"]
end

subgraph group_api["Assistant API"]
  node_backend["FastAPI app<br/>[main.py]"]
  node_prompt_api["Prompt endpoint"]
  node_llm["LLM task parsing<br/>[llm.py]"]
  node_task_schema["Task schema"]
end

subgraph group_actions["Assistant capabilities"]
  node_task_router["Task executor<br/>[TaskRouter.py]"]
  node_browser["Browser actions<br/>[browser_module.py]"]
  node_desktop["Desktop actions<br/>[desktop_module.py]"]
  node_file_ops["File operations"]
  node_pdf_api["PDF assistant API"]
  node_pdf_clients["PDF retrieval clients"]
  node_stt_api["Speech recognition API<br/>[stt_endpoints.py]"]
  node_stt["Speech recognition<br/>[speech_to_text.py]"]
  node_tts["Speech output<br/>[tts.py]"]
end

subgraph group_memory["Persistent memory"]
  node_memory_api["Memory endpoints"]
  node_memory_ops["Memory operations"]
  node_settings_api["Settings endpoints"]
  node_memory_db[("Memory database<br/>[db.py]")]
  node_memory_storage["Shared settings state"]
  node_settings_ops["Settings queries"]
end

node_user(("User"))
node_groq["Groq service"]
node_local_llm["Local LLM service"]

node_user -->|"uses"| node_app
node_app -->|"renders"| node_chat
node_app -->|"routes to"| node_memory_ui
node_app -->|"routes to"| node_settings_ui
node_app -->|"routes to"| node_dashboard
node_chat -->|"sends prompts"| node_chat_client
node_chat -->|"queries PDFs"| node_pdf_client
node_app -->|"transcribes audio"| node_stt_client
node_app -->|"loads settings"| node_settings_client
node_memory_ui -->|"manages locations"| node_memory_client
node_memory_client -->|"uses base URL"| node_api_config
node_chat_client -.->|"uses base URL"| node_api_config
node_pdf_client -.->|"uses base URL"| node_api_config
node_settings_client -.->|"uses base URL"| node_api_config
node_stt_client -.->|"uses base URL"| node_api_config
node_chat_client -.->|"HTTP requests"| node_backend
node_pdf_client -.->|"HTTP requests"| node_pdf_api
node_settings_client -.->|"HTTP requests"| node_settings_api
node_stt_client -.->|"HTTP requests"| node_stt_api
node_memory_client -.->|"HTTP requests"| node_memory_api
node_backend -->|"registers router"| node_prompt_api
node_backend -->|"registers router"| node_memory_api
node_backend -->|"registers router"| node_settings_api
node_backend -->|"registers router"| node_pdf_api
node_backend -->|"registers router"| node_stt_api
node_prompt_api -->|"parses prompt"| node_llm
node_prompt_api -->|"validates tasks"| node_task_schema
node_llm -->|"requests completion"| node_groq
node_llm -->|"requests completion"| node_local_llm
node_prompt_api -->|"reads settings"| node_memory_storage
node_prompt_api -->|"executes tasks"| node_task_router
node_prompt_api -->|"speaks responses"| node_tts
node_backend -->|"initializes"| node_task_router
node_backend -->|"initializes"| node_tts
node_task_router -.->|"dispatches tasks"| node_browser
node_task_router -.->|"dispatches tasks"| node_desktop
node_desktop -.->|"delegates file tasks"| node_file_ops
node_pdf_api -.->|"delegates retrieval"| node_pdf_clients
node_stt_api -.->|"transcribes audio"| node_stt
node_tts -->|"plays speech"| node_user
node_memory_api -.->|"manages locations"| node_memory_ops
node_memory_api -.->|"reads and writes"| node_memory_db
node_settings_api -.->|"reads and writes"| node_memory_db
node_settings_api -.->|"loads settings"| node_settings_ops
node_backend -->|"initializes"| node_memory_db
node_backend -->|"loads settings"| node_memory_storage
node_backend -->|"fetches settings"| node_settings_ops
node_backend -->|"fetches locations"| node_memory_ops

click node_app "https://github.com/abrar822/friday_ai/blob/main/frontend/src/App.jsx"
click node_chat "https://github.com/abrar822/friday_ai/blob/main/frontend/src/components/Chatbox.jsx"
click node_memory_ui "https://github.com/abrar822/friday_ai/blob/main/frontend/src/pages/Memory.jsx"
click node_settings_ui "https://github.com/abrar822/friday_ai/blob/main/frontend/src/pages/Settings.jsx"
click node_dashboard "https://github.com/abrar822/friday_ai/blob/main/frontend/src/pages/Dashboard.jsx"
click node_memory_client "https://github.com/abrar822/friday_ai/blob/main/frontend/src/helper/MemoryConnect.js"
click node_chat_client "https://github.com/abrar822/friday_ai/blob/main/frontend/src/helper/FastapiConnect.js"
click node_pdf_client "https://github.com/abrar822/friday_ai/blob/main/frontend/src/helper/pdf_assistant_api.js"
click node_settings_client "https://github.com/abrar822/friday_ai/blob/main/frontend/src/helper/setting_api.js"
click node_stt_client "https://github.com/abrar822/friday_ai/blob/main/frontend/src/helper/sttConnect.js"
click node_api_config "https://github.com/abrar822/friday_ai/blob/main/frontend/src/config/api.js"
click node_backend "https://github.com/abrar822/friday_ai/blob/main/backend/main.py"
click node_prompt_api "https://github.com/abrar822/friday_ai/blob/main/backend/core/llm_prompt_endpoint.py"
click node_llm "https://github.com/abrar822/friday_ai/blob/main/backend/core/llm.py"
click node_task_schema "https://github.com/abrar822/friday_ai/blob/main/backend/pydantic_models/task_router_models.py"
click node_task_router "https://github.com/abrar822/friday_ai/blob/main/backend/core/TaskRouter.py"
click node_browser "https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/browser_module/browser_module.py"
click node_desktop "https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/desktop_module/desktop_module.py"
click node_file_ops "https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/desktop_module/file_operations_sub_module.py"
click node_pdf_api "https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/pdf_assistant_module/pdf_ass_endpoints.py"
click node_pdf_clients "https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/pdf_assistant_module/pdf_assistant_clients.py"
click node_stt_api "https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/speech_to_text_module/stt_endpoints.py"
click node_stt "https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/speech_to_text_module/speech_to_text.py"
click node_tts "https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/text_to_speech_module/Piper_TTS/tts.py"
click node_memory_api "https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/persistent_memory/memory_endpoints.py"
click node_memory_ops "https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/persistent_memory/memory_operations.py"
click node_settings_api "https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/persistent_memory/setting_endpoints.py"
click node_memory_db "https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/persistent_memory/db.py"
click node_memory_storage "https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/persistent_memory/storage_declarations.py"
click node_settings_ops "https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/persistent_memory/general_db_operations.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_app,node_chat,node_memory_ui,node_settings_ui,node_dashboard,node_memory_client,node_chat_client,node_pdf_client,node_settings_client,node_stt_client,node_api_config,node_user toneBlue
class node_backend,node_prompt_api,node_llm,node_task_schema toneAmber
class node_task_router,node_browser,node_desktop,node_file_ops,node_pdf_api,node_pdf_clients,node_stt_api,node_stt,node_tts toneMint
class node_memory_api,node_memory_ops,node_settings_api,node_memory_db,node_memory_storage,node_settings_ops toneRose
class node_groq,node_local_llm toneIndigo
```

## Components

### Desktop client

- [App shell](https://github.com/abrar822/friday_ai/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Chat and modes](https://github.com/abrar822/friday_ai/blob/main/frontend/src/components/Chatbox.jsx): `frontend/src/components/Chatbox.jsx`
- [Memory manager](https://github.com/abrar822/friday_ai/blob/main/frontend/src/pages/Memory.jsx): `frontend/src/pages/Memory.jsx`
- [Settings page](https://github.com/abrar822/friday_ai/blob/main/frontend/src/pages/Settings.jsx): `frontend/src/pages/Settings.jsx`
- [Dashboard](https://github.com/abrar822/friday_ai/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Memory API client](https://github.com/abrar822/friday_ai/blob/main/frontend/src/helper/MemoryConnect.js): `frontend/src/helper/MemoryConnect.js`
- [Chat API client](https://github.com/abrar822/friday_ai/blob/main/frontend/src/helper/FastapiConnect.js): `frontend/src/helper/FastapiConnect.js`
- [PDF API client](https://github.com/abrar822/friday_ai/blob/main/frontend/src/helper/pdf_assistant_api.js): `frontend/src/helper/pdf_assistant_api.js`
- [Settings API client](https://github.com/abrar822/friday_ai/blob/main/frontend/src/helper/setting_api.js): `frontend/src/helper/setting_api.js`
- [Speech API client](https://github.com/abrar822/friday_ai/blob/main/frontend/src/helper/sttConnect.js): `frontend/src/helper/sttConnect.js`
- [API base config](https://github.com/abrar822/friday_ai/blob/main/frontend/src/config/api.js): `frontend/src/config/api.js`

### Assistant API

- [FastAPI app](https://github.com/abrar822/friday_ai/blob/main/backend/main.py): `backend/main.py`
- [Prompt endpoint](https://github.com/abrar822/friday_ai/blob/main/backend/core/llm_prompt_endpoint.py): `backend/core/llm_prompt_endpoint.py`
- [LLM task parsing](https://github.com/abrar822/friday_ai/blob/main/backend/core/llm.py): `backend/core/llm.py`
- [Task schema](https://github.com/abrar822/friday_ai/blob/main/backend/pydantic_models/task_router_models.py): `backend/pydantic_models/task_router_models.py`

### Assistant capabilities

- [Task executor](https://github.com/abrar822/friday_ai/blob/main/backend/core/TaskRouter.py): `backend/core/TaskRouter.py`
- [Browser actions](https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/browser_module/browser_module.py): `backend/friday_modules/browser_module/browser_module.py`
- [Desktop actions](https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/desktop_module/desktop_module.py): `backend/friday_modules/desktop_module/desktop_module.py`
- [File operations](https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/desktop_module/file_operations_sub_module.py): `backend/friday_modules/desktop_module/file_operations_sub_module.py`
- [PDF assistant API](https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/pdf_assistant_module/pdf_ass_endpoints.py): `backend/friday_modules/pdf_assistant_module/pdf_ass_endpoints.py`
- [PDF retrieval clients](https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/pdf_assistant_module/pdf_assistant_clients.py): `backend/friday_modules/pdf_assistant_module/pdf_assistant_clients.py`
- [Speech recognition API](https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/speech_to_text_module/stt_endpoints.py): `backend/friday_modules/speech_to_text_module/stt_endpoints.py`
- [Speech recognition](https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/speech_to_text_module/speech_to_text.py): `backend/friday_modules/speech_to_text_module/speech_to_text.py`
- [Speech output](https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/text_to_speech_module/Piper_TTS/tts.py): `backend/friday_modules/text_to_speech_module/Piper_TTS/tts.py`

### Persistent memory

- [Memory endpoints](https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/persistent_memory/memory_endpoints.py): `backend/friday_modules/persistent_memory/memory_endpoints.py`
- [Memory operations](https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/persistent_memory/memory_operations.py): `backend/friday_modules/persistent_memory/memory_operations.py`
- [Settings endpoints](https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/persistent_memory/setting_endpoints.py): `backend/friday_modules/persistent_memory/setting_endpoints.py`
- [Memory database](https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/persistent_memory/db.py): `backend/friday_modules/persistent_memory/db.py`
- [Shared settings state](https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/persistent_memory/storage_declarations.py): `backend/friday_modules/persistent_memory/storage_declarations.py`
- [Settings queries](https://github.com/abrar822/friday_ai/blob/main/backend/friday_modules/persistent_memory/general_db_operations.py): `backend/friday_modules/persistent_memory/general_db_operations.py`

### Other components

- **User**
- **Groq service**
- **Local LLM service**

## Connections

- User → App shell: uses (evidence: `frontend/src/App.jsx`)
- App shell → Chat and modes: renders (evidence: `frontend/src/App.jsx`)
- App shell → Memory manager: routes to (evidence: `frontend/src/App.jsx`)
- App shell → Settings page: routes to (evidence: `frontend/src/App.jsx`)
- App shell → Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Chat and modes → Chat API client: sends prompts (evidence: `frontend/src/components/Chatbox.jsx`)
- Chat and modes → PDF API client: queries PDFs (evidence: `frontend/src/components/Chatbox.jsx`)
- App shell → Speech API client: transcribes audio (evidence: `frontend/src/App.jsx`)
- App shell → Settings API client: loads settings (evidence: `frontend/src/App.jsx`)
- Memory manager → Memory API client: manages locations (evidence: `frontend/src/pages/Memory.jsx`)
- Memory API client → API base config: uses base URL (evidence: `frontend/src/helper/MemoryConnect.js`)
- Chat API client → API base config: uses base URL
- PDF API client → API base config: uses base URL
- Settings API client → API base config: uses base URL
- Speech API client → API base config: uses base URL
- Chat API client → FastAPI app: HTTP requests
- PDF API client → PDF assistant API: HTTP requests
- Settings API client → Settings endpoints: HTTP requests
- Speech API client → Speech recognition API: HTTP requests
- Memory API client → Memory endpoints: HTTP requests
- FastAPI app → Prompt endpoint: registers router (evidence: `backend/main.py`)
- FastAPI app → Memory endpoints: registers router (evidence: `backend/main.py`)
- FastAPI app → Settings endpoints: registers router (evidence: `backend/main.py`)
- FastAPI app → PDF assistant API: registers router (evidence: `backend/main.py`)
- FastAPI app → Speech recognition API: registers router (evidence: `backend/main.py`)
- Prompt endpoint → LLM task parsing: parses prompt (evidence: `backend/core/llm_prompt_endpoint.py`)
- Prompt endpoint → Task schema: validates tasks (evidence: `backend/core/llm_prompt_endpoint.py`)
- LLM task parsing → Groq service: requests completion (evidence: `backend/core/llm.py`)
- LLM task parsing → Local LLM service: requests completion (evidence: `backend/core/llm.py`)
- Prompt endpoint → Shared settings state: reads settings (evidence: `backend/core/llm_prompt_endpoint.py`)
- Prompt endpoint → Task executor: executes tasks (evidence: `backend/core/llm_prompt_endpoint.py`)
- Prompt endpoint → Speech output: speaks responses (evidence: `backend/core/llm_prompt_endpoint.py`)
- FastAPI app → Task executor: initializes (evidence: `backend/main.py`)
- FastAPI app → Speech output: initializes (evidence: `backend/main.py`)
- Task executor → Browser actions: dispatches tasks
- Task executor → Desktop actions: dispatches tasks
- Desktop actions → File operations: delegates file tasks
- PDF assistant API → PDF retrieval clients: delegates retrieval
- Speech recognition API → Speech recognition: transcribes audio
- Speech output → User: plays speech (evidence: `backend/friday_modules/text_to_speech_module/Piper_TTS/tts.py`)
- Memory endpoints → Memory operations: manages locations
- Memory endpoints → Memory database: reads and writes
- Settings endpoints → Memory database: reads and writes
- Settings endpoints → Settings queries: loads settings
- FastAPI app → Memory database: initializes (evidence: `backend/main.py`)
- FastAPI app → Shared settings state: loads settings (evidence: `backend/main.py`)
- FastAPI app → Settings queries: fetches settings (evidence: `backend/main.py`)
- FastAPI app → Memory operations: fetches locations (evidence: `backend/main.py`)
