# oskarbartoszyk/personalassistant architecture

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

- Interactive diagram: https://gitdiagram.com/oskarbartoszyk/personalassistant
- Repository: https://github.com/oskarbartoszyk/personalassistant

## Overview

Kalendarz is a single-user calendar with a conversational assistant. A user opens the web app to browse and edit events, reminders, and notes directly; separately, chat sends messages to the backend agent, which can use tools to work with calendar data and memory. The frontend also supports browser-based voice input and speech output. The backend exposes REST operations and chat streaming, with SQLite as shared persistence. Source excerpts show the main calls, but several backend routes and agent tools were only partially sampled; the graph keeps those within their documented modules.

Main entry points: [`frontend/js/chat.js`](https://github.com/oskarbartoszyk/personalassistant/blob/main/frontend/js/chat.js) (Chat and voice UI), [`frontend/js/app.js`](https://github.com/oskarbartoszyk/personalassistant/blob/main/frontend/js/app.js) (App bootstrap), [`frontend/js/api.js`](https://github.com/oskarbartoszyk/personalassistant/blob/main/frontend/js/api.js) (API client and state), [`frontend/js/panels.js`](https://github.com/oskarbartoszyk/personalassistant/blob/main/frontend/js/panels.js) (Reminder and note panels)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_bootstrap["App bootstrap<br/>[app.js]"]
  node_api_client["API client and state<br/>[api.js]"]
  node_calendar_ui["Calendar views<br/>[calendar.js]"]
  node_panels_ui["Reminder and note panels<br/>[panels.js]"]
  node_chat_ui["Chat and voice UI<br/>[chat.js]"]
end

subgraph group_backend["Backend services"]
  node_rest_api["REST and chat API<br/>[main.py]"]
  node_agent["Assistant agent<br/>[agent.py]"]
end

subgraph group_data["Persistent data"]
  node_sqlite_data[("Calendar and memory data<br/>[db.py]")]
  node_sqlite_file[("SQLite database file<br/>[kalendarz.db]")]
end

subgraph group_integrations["External capabilities"]
  node_ollama["Ollama model"]
  node_browser_speech["Browser speech APIs"]
end

node_user(("Calendar user"))

node_user -->|"uses"| node_bootstrap
node_bootstrap -->|"initializes"| node_calendar_ui
node_bootstrap -->|"initializes"| node_panels_ui
node_bootstrap -->|"initializes"| node_chat_ui
node_bootstrap -->|"loads events"| node_api_client
node_calendar_ui -->|"loads and edits events"| node_api_client
node_panels_ui -->|"reads and writes"| node_api_client
node_panels_ui -->|"reloads events"| node_calendar_ui
node_chat_ui -->|"streams chat"| node_rest_api
node_chat_ui -->|"loads history"| node_api_client
node_chat_ui -->|"refreshes events"| node_calendar_ui
node_chat_ui -->|"refreshes panels"| node_panels_ui
node_chat_ui -->|"uses speech"| node_browser_speech
node_api_client -->|"sends REST requests"| node_rest_api
node_rest_api -->|"handles CRUD"| node_sqlite_data
node_rest_api -->|"dispatches chat"| node_agent
node_agent -->|"reads and writes"| node_sqlite_data
node_agent -->|"calls model"| node_ollama
node_sqlite_data -->|"persists data"| node_sqlite_file

click node_bootstrap "https://github.com/oskarbartoszyk/personalassistant/blob/main/frontend/js/app.js"
click node_api_client "https://github.com/oskarbartoszyk/personalassistant/blob/main/frontend/js/api.js"
click node_calendar_ui "https://github.com/oskarbartoszyk/personalassistant/blob/main/frontend/js/calendar.js"
click node_panels_ui "https://github.com/oskarbartoszyk/personalassistant/blob/main/frontend/js/panels.js"
click node_chat_ui "https://github.com/oskarbartoszyk/personalassistant/blob/main/frontend/js/chat.js"
click node_rest_api "https://github.com/oskarbartoszyk/personalassistant/blob/main/backend/main.py"
click node_agent "https://github.com/oskarbartoszyk/personalassistant/blob/main/backend/agent.py"
click node_sqlite_data "https://github.com/oskarbartoszyk/personalassistant/blob/main/backend/db.py"
click node_sqlite_file "https://github.com/oskarbartoszyk/personalassistant/blob/main/backend/kalendarz.db"

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_bootstrap,node_api_client,node_calendar_ui,node_panels_ui,node_chat_ui,node_user toneBlue
class node_rest_api,node_agent toneAmber
class node_sqlite_data,node_sqlite_file toneMint
class node_ollama,node_browser_speech toneRose
```

## Components

### Web application

- [App bootstrap](https://github.com/oskarbartoszyk/personalassistant/blob/main/frontend/js/app.js): `frontend/js/app.js`
- [API client and state](https://github.com/oskarbartoszyk/personalassistant/blob/main/frontend/js/api.js): `frontend/js/api.js`
- [Calendar views](https://github.com/oskarbartoszyk/personalassistant/blob/main/frontend/js/calendar.js): `frontend/js/calendar.js`
- [Reminder and note panels](https://github.com/oskarbartoszyk/personalassistant/blob/main/frontend/js/panels.js): `frontend/js/panels.js`
- [Chat and voice UI](https://github.com/oskarbartoszyk/personalassistant/blob/main/frontend/js/chat.js): `frontend/js/chat.js`

### Backend services

- [REST and chat API](https://github.com/oskarbartoszyk/personalassistant/blob/main/backend/main.py): `backend/main.py`
- [Assistant agent](https://github.com/oskarbartoszyk/personalassistant/blob/main/backend/agent.py): `backend/agent.py`

### Persistent data

- [Calendar and memory data](https://github.com/oskarbartoszyk/personalassistant/blob/main/backend/db.py): `backend/db.py`
- [SQLite database file](https://github.com/oskarbartoszyk/personalassistant/blob/main/backend/kalendarz.db): `backend/kalendarz.db`

### External capabilities

- **Ollama model**
- **Browser speech APIs**

### Other components

- **Calendar user**

## Connections

- Calendar user → App bootstrap: uses
- App bootstrap → Calendar views: initializes (evidence: `frontend/js/app.js`)
- App bootstrap → Reminder and note panels: initializes (evidence: `frontend/js/app.js`)
- App bootstrap → Chat and voice UI: initializes (evidence: `frontend/js/app.js`)
- App bootstrap → API client and state: loads events (evidence: `frontend/js/app.js`)
- Calendar views → API client and state: loads and edits events (evidence: `frontend/js/calendar.js`)
- Reminder and note panels → API client and state: reads and writes (evidence: `frontend/js/panels.js`)
- Reminder and note panels → Calendar views: reloads events (evidence: `frontend/js/panels.js`)
- Chat and voice UI → REST and chat API: streams chat (evidence: `frontend/js/chat.js`)
- Chat and voice UI → API client and state: loads history (evidence: `frontend/js/chat.js`)
- Chat and voice UI → Calendar views: refreshes events (evidence: `frontend/js/chat.js`)
- Chat and voice UI → Reminder and note panels: refreshes panels (evidence: `frontend/js/chat.js`)
- Chat and voice UI → Browser speech APIs: uses speech (evidence: `frontend/js/chat.js`)
- API client and state → REST and chat API: sends REST requests (evidence: `frontend/js/api.js`)
- REST and chat API → Calendar and memory data: handles CRUD (evidence: `backend/main.py`)
- REST and chat API → Assistant agent: dispatches chat (evidence: `backend/main.py`)
- Assistant agent → Calendar and memory data: reads and writes (evidence: `backend/agent.py`)
- Assistant agent → Ollama model: calls model (evidence: `backend/agent.py`)
- Calendar and memory data → SQLite database file: persists data (evidence: `backend/db.py`)
