# ahmadshanti/sure architecture

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

- Interactive diagram: https://gitdiagram.com/ahmadshanti/sure
- Repository: https://github.com/ahmadshanti/sure

## Overview

Sure is a self-hostable personal-finance and wealth-management application, also reachable through browser, desktop/mobile clients, API clients, and LLM agents. The central workflow is a user connecting financial providers or importing records, then reviewing and managing accounts, transactions, budgets, investments, bills, and reports; AI chat adds grounded analysis and actions. The map groups these domain stages with authentication/API access and the interactive presentation layer. Edges are limited to README statements or shown calls/configuration; many route-to-controller and persistence links are omitted because source excerpts do not establish them.

Main entry points: [`app/controllers`](https://github.com/ahmadshanti/sure/tree/main/app/controllers) (Web application), [`app/controllers/api/v1`](https://github.com/ahmadshanti/sure/tree/main/app/controllers/api/v1) (REST API), [`desktop/src/main.ts`](https://github.com/ahmadshanti/sure/blob/main/desktop/src/main.ts) (Desktop client), [`app/controllers/bills/ai_reviews_controller.rb`](https://github.com/ahmadshanti/sure/blob/main/app/controllers/bills/ai_reviews_controller.rb) (Bill review prompt)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and clients"]
  node_web["Web application"]
  node_api["REST API"]
  node_desktop["Desktop client<br/>[main.ts]"]
  node_auth["Authentication<br/>[auth_controller.rb]"]
end

subgraph group_finance["Financial data"]
  node_providers["Provider connections"]
  node_imports["Financial imports"]
  node_accounts["Accounts and balances"]
  node_transactions["Transactions"]
  node_investments["Investments"]
  node_files["Attachments"]
end

subgraph group_analysis["Planning and insight"]
  node_budgets["Budgets and categories"]
  node_bills["Bills and recurring"]
  node_goals["Goals"]
  node_reports["Reports and insights"]
end

subgraph group_assist["AI assistance"]
  node_ai["AI chat<br/>[routes.rb]"]
  node_ai_review["Bill review prompt"]
end

subgraph group_presentation["Interactive UI"]
  node_ui_components["Design components"]
  node_charts["Cash-flow visualization"]
  node_pwa["Offline service worker<br/>[service-worker.js]"]
end

node_people(("People and clients"))

node_people -->|"uses browser"| node_web
node_people -->|"uses desktop"| node_desktop
node_people -->|"uses API"| node_api
node_people -->|"uses agents"| node_ai
node_desktop -->|"opens server"| node_web
node_api -->|"authenticates"| node_auth
node_web -.->|"connects providers"| node_providers
node_web -.->|"imports records"| node_imports
node_web -.->|"manages accounts"| node_accounts
node_web -.->|"manages activity"| node_transactions
node_web -.->|"tracks holdings"| node_investments
node_web -.->|"plans spending"| node_budgets
node_web -.->|"reviews bills"| node_bills
node_web -.->|"sets goals"| node_goals
node_web -.->|"views reports"| node_reports
node_web -->|"serves attachments"| node_files
node_ai_review -->|"starts chat"| node_ai
node_web -.->|"requests review"| node_ai_review
node_charts -->|"navigates filters"| node_transactions
node_web -.->|"renders interface"| node_ui_components
node_web -.->|"provides offline support"| node_pwa

click node_web "https://github.com/ahmadshanti/sure/tree/main/app/controllers"
click node_api "https://github.com/ahmadshanti/sure/tree/main/app/controllers/api/v1"
click node_desktop "https://github.com/ahmadshanti/sure/blob/main/desktop/src/main.ts"
click node_auth "https://github.com/ahmadshanti/sure/blob/main/app/controllers/api/v1/auth_controller.rb"
click node_providers "https://github.com/ahmadshanti/sure/blob/main/app/controllers/provider_items_controller.rb"
click node_imports "https://github.com/ahmadshanti/sure/blob/main/app/controllers/import/uploads_controller.rb"
click node_accounts "https://github.com/ahmadshanti/sure/blob/main/app/models/account/current_balance_manager.rb"
click node_transactions "https://github.com/ahmadshanti/sure/blob/main/app/controllers/transactions_controller.rb"
click node_investments "https://github.com/ahmadshanti/sure/blob/main/app/controllers/holdings_controller.rb"
click node_files "https://github.com/ahmadshanti/sure/blob/main/config/initializers/active_storage_authorization.rb"
click node_budgets "https://github.com/ahmadshanti/sure/blob/main/app/controllers/budgets_controller.rb"
click node_bills "https://github.com/ahmadshanti/sure/blob/main/app/controllers/bills_controller.rb"
click node_goals "https://github.com/ahmadshanti/sure/blob/main/app/controllers/goals_controller.rb"
click node_reports "https://github.com/ahmadshanti/sure/blob/main/app/controllers/reports_controller.rb"
click node_ai "https://github.com/ahmadshanti/sure/blob/main/app/models/ai/routes.rb"
click node_ai_review "https://github.com/ahmadshanti/sure/blob/main/app/controllers/bills/ai_reviews_controller.rb"
click node_ui_components "https://github.com/ahmadshanti/sure/tree/main/app/components/DS"
click node_charts "https://github.com/ahmadshanti/sure/blob/main/app/javascript/controllers/preview_sankey_chart_controller.js"
click node_pwa "https://github.com/ahmadshanti/sure/blob/main/app/views/pwa/service-worker.js"

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_web,node_api,node_desktop,node_auth,node_people toneBlue
class node_providers,node_imports,node_accounts,node_transactions,node_investments,node_files toneAmber
class node_budgets,node_bills,node_goals,node_reports toneMint
class node_ai,node_ai_review toneRose
class node_ui_components,node_charts,node_pwa toneIndigo
```

## Components

### Access and clients

- [Web application](https://github.com/ahmadshanti/sure/tree/main/app/controllers): `app/controllers`
- [REST API](https://github.com/ahmadshanti/sure/tree/main/app/controllers/api/v1): `app/controllers/api/v1`
- [Desktop client](https://github.com/ahmadshanti/sure/blob/main/desktop/src/main.ts): `desktop/src/main.ts`
- [Authentication](https://github.com/ahmadshanti/sure/blob/main/app/controllers/api/v1/auth_controller.rb): `app/controllers/api/v1/auth_controller.rb`

### Financial data

- [Provider connections](https://github.com/ahmadshanti/sure/blob/main/app/controllers/provider_items_controller.rb): `app/controllers/provider_items_controller.rb`
- [Financial imports](https://github.com/ahmadshanti/sure/blob/main/app/controllers/import/uploads_controller.rb): `app/controllers/import/uploads_controller.rb`
- [Accounts and balances](https://github.com/ahmadshanti/sure/blob/main/app/models/account/current_balance_manager.rb): `app/models/account/current_balance_manager.rb`
- [Transactions](https://github.com/ahmadshanti/sure/blob/main/app/controllers/transactions_controller.rb): `app/controllers/transactions_controller.rb`
- [Investments](https://github.com/ahmadshanti/sure/blob/main/app/controllers/holdings_controller.rb): `app/controllers/holdings_controller.rb`
- [Attachments](https://github.com/ahmadshanti/sure/blob/main/config/initializers/active_storage_authorization.rb): `config/initializers/active_storage_authorization.rb`

### Planning and insight

- [Budgets and categories](https://github.com/ahmadshanti/sure/blob/main/app/controllers/budgets_controller.rb): `app/controllers/budgets_controller.rb`
- [Bills and recurring](https://github.com/ahmadshanti/sure/blob/main/app/controllers/bills_controller.rb): `app/controllers/bills_controller.rb`
- [Goals](https://github.com/ahmadshanti/sure/blob/main/app/controllers/goals_controller.rb): `app/controllers/goals_controller.rb`
- [Reports and insights](https://github.com/ahmadshanti/sure/blob/main/app/controllers/reports_controller.rb): `app/controllers/reports_controller.rb`

### AI assistance

- [AI chat](https://github.com/ahmadshanti/sure/blob/main/app/models/ai/routes.rb): `app/models/ai/routes.rb`
- [Bill review prompt](https://github.com/ahmadshanti/sure/blob/main/app/controllers/bills/ai_reviews_controller.rb): `app/controllers/bills/ai_reviews_controller.rb`

### Interactive UI

- [Design components](https://github.com/ahmadshanti/sure/tree/main/app/components/DS): `app/components/DS`
- [Cash-flow visualization](https://github.com/ahmadshanti/sure/blob/main/app/javascript/controllers/preview_sankey_chart_controller.js): `app/javascript/controllers/preview_sankey_chart_controller.js`
- [Offline service worker](https://github.com/ahmadshanti/sure/blob/main/app/views/pwa/service-worker.js): `app/views/pwa/service-worker.js`

### Other components

- **People and clients**

## Connections

- People and clients → Web application: uses browser
- People and clients → Desktop client: uses desktop
- People and clients → REST API: uses API
- People and clients → AI chat: uses agents
- Desktop client → Web application: opens server (evidence: `desktop/src/main.ts`)
- REST API → Authentication: authenticates
- Web application → Provider connections: connects providers
- Web application → Financial imports: imports records
- Web application → Accounts and balances: manages accounts
- Web application → Transactions: manages activity
- Web application → Investments: tracks holdings
- Web application → Budgets and categories: plans spending
- Web application → Bills and recurring: reviews bills
- Web application → Goals: sets goals
- Web application → Reports and insights: views reports
- Web application → Attachments: serves attachments (evidence: `config/initializers/active_storage_authorization.rb`)
- Bill review prompt → AI chat: starts chat (evidence: `app/controllers/bills/ai_reviews_controller.rb`)
- Web application → Bill review prompt: requests review
- Cash-flow visualization → Transactions: navigates filters (evidence: `app/javascript/controllers/preview_sankey_chart_controller.js`)
- Web application → Design components: renders interface
- Web application → Offline service worker: provides offline support
