# prestonwanttorevenge/expense-management architecture

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

- Interactive diagram: https://gitdiagram.com/prestonwanttorevenge/expense-management
- Repository: https://github.com/prestonwanttorevenge/expense-management

## Overview

Alikaka is a Vietnamese personal income-and-expense ledger: users manage categories and VND transactions, then inspect filtered cash-flow summaries in a browser dashboard or through REST endpoints. The documented flow runs from the static UI or API client through FastAPI routers, service validation, repositories, and SQLite; results return as JSON for the UI’s ledger, charts, and CSV export. The README documents UI behavior and API capabilities beyond the excerpts. Edges below use README or indexed/import-visible evidence; unsampled details are not asserted.

Main entry points: [`app/services/transactions.py`](https://github.com/prestonwanttorevenge/expense-management/blob/main/app/services/transactions.py) (Transaction and summary service), [`app/main.py`](https://github.com/prestonwanttorevenge/expense-management/blob/main/app/main.py) (FastAPI runtime), [`app/api/deps.py`](https://github.com/prestonwanttorevenge/expense-management/blob/main/app/api/deps.py) (Service dependencies), [`app/api/v1`](https://github.com/prestonwanttorevenge/expense-management/tree/main/app/api/v1) (REST routers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry points"]
  node_app_runtime["FastAPI runtime<br/>[main.py]"]
  node_api_routes["REST routers"]
  node_dependency_wiring["Service dependencies<br/>[deps.py]"]
  node_problem_errors["Problem errors<br/>[exceptions.py]"]
end

subgraph group_domain["Ledger domain"]
  node_category_api["Category API<br/>[categories.py]"]
  node_transaction_api["Transaction API<br/>[transactions.py]"]
  node_summary_api["Health and summary API<br/>[summary.py]"]
  node_category_service["Category service<br/>[categories.py]"]
  node_transaction_service["Transaction and summary service<br/>[transactions.py]"]
  node_category_schema["Category schemas<br/>[category.py]"]
  node_transaction_schema["Transaction schemas<br/>[transaction.py]"]
  node_common_schema["Shared API schemas<br/>[common.py]"]
  node_summary_schema["Summary schema<br/>[summary.py]"]
end

subgraph group_persistence["Persistence"]
  node_category_repo["Category repository<br/>[categories.py]"]
  node_transaction_repo["Transaction repository<br/>[transactions.py]"]
  node_sqlite_layer["SQLite setup<br/>[sqlite.py]"]
  node_sqlite_store[("SQLite ledger")]
end

subgraph group_presentation["Presentation"]
  node_web_ui["Ledger dashboard<br/>[index.html]"]
  node_web_logic["Dashboard behavior<br/>[app.js]"]
  node_web_style["Dashboard styling<br/>[app.css]"]
end

node_browser_user(("Ledger user"))
node_api_client(("API client"))

node_browser_user -->|"uses"| node_web_ui
node_web_ui -->|"loads"| node_web_logic
node_web_logic -->|"HTTP requests"| node_app_runtime
node_api_client -->|"HTTP requests"| node_app_runtime
node_app_runtime -->|"mounts"| node_api_routes
node_app_runtime -->|"registers handlers"| node_problem_errors
node_api_routes -->|"routes"| node_category_api
node_api_routes -->|"routes"| node_transaction_api
node_api_routes -->|"routes"| node_summary_api
node_category_api -->|"injects service"| node_dependency_wiring
node_transaction_api -->|"injects service"| node_dependency_wiring
node_summary_api -->|"injects service"| node_dependency_wiring
node_dependency_wiring -->|"constructs"| node_category_service
node_dependency_wiring -->|"constructs"| node_transaction_service
node_category_api -->|"calls"| node_category_service
node_transaction_api -->|"calls"| node_transaction_service
node_summary_api -->|"calls"| node_transaction_service
node_category_api -->|"validates output"| node_category_schema
node_transaction_api -->|"validates payload"| node_transaction_schema
node_summary_api -->|"returns shape"| node_summary_schema
node_category_schema -->|"uses helpers"| node_common_schema
node_transaction_schema -->|"uses metadata"| node_common_schema
node_category_service -->|"calls"| node_category_repo
node_transaction_service -->|"calls"| node_transaction_repo
node_transaction_service -->|"checks category"| node_category_repo
node_category_service -->|"raises domain errors"| node_problem_errors
node_transaction_service -->|"raises domain errors"| node_problem_errors
node_category_repo -->|"uses SQL helpers"| node_sqlite_layer
node_transaction_repo -->|"uses SQL helpers"| node_sqlite_layer
node_app_runtime -->|"initializes database"| node_sqlite_layer
node_sqlite_layer -->|"creates and configures"| node_sqlite_store
node_category_repo -->|"reads and writes"| node_sqlite_store
node_transaction_repo -->|"reads and writes"| node_sqlite_store
node_web_logic -->|"renders styled UI"| node_web_style
node_web_logic -->|"updates dashboard"| node_web_ui

click node_app_runtime "https://github.com/prestonwanttorevenge/expense-management/blob/main/app/main.py"
click node_api_routes "https://github.com/prestonwanttorevenge/expense-management/tree/main/app/api/v1"
click node_dependency_wiring "https://github.com/prestonwanttorevenge/expense-management/blob/main/app/api/deps.py"
click node_problem_errors "https://github.com/prestonwanttorevenge/expense-management/blob/main/app/core/exceptions.py"
click node_category_api "https://github.com/prestonwanttorevenge/expense-management/blob/main/app/api/v1/categories.py"
click node_transaction_api "https://github.com/prestonwanttorevenge/expense-management/blob/main/app/api/v1/transactions.py"
click node_summary_api "https://github.com/prestonwanttorevenge/expense-management/blob/main/app/api/v1/summary.py"
click node_category_service "https://github.com/prestonwanttorevenge/expense-management/blob/main/app/services/categories.py"
click node_transaction_service "https://github.com/prestonwanttorevenge/expense-management/blob/main/app/services/transactions.py"
click node_category_schema "https://github.com/prestonwanttorevenge/expense-management/blob/main/app/schemas/category.py"
click node_transaction_schema "https://github.com/prestonwanttorevenge/expense-management/blob/main/app/schemas/transaction.py"
click node_common_schema "https://github.com/prestonwanttorevenge/expense-management/blob/main/app/schemas/common.py"
click node_summary_schema "https://github.com/prestonwanttorevenge/expense-management/blob/main/app/schemas/summary.py"
click node_category_repo "https://github.com/prestonwanttorevenge/expense-management/blob/main/app/repositories/categories.py"
click node_transaction_repo "https://github.com/prestonwanttorevenge/expense-management/blob/main/app/repositories/transactions.py"
click node_sqlite_layer "https://github.com/prestonwanttorevenge/expense-management/blob/main/app/db/sqlite.py"
click node_web_ui "https://github.com/prestonwanttorevenge/expense-management/blob/main/app/static/index.html"
click node_web_logic "https://github.com/prestonwanttorevenge/expense-management/blob/main/app/static/app.js"
click node_web_style "https://github.com/prestonwanttorevenge/expense-management/blob/main/app/static/app.css"

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_runtime,node_api_routes,node_dependency_wiring,node_problem_errors,node_browser_user,node_api_client toneBlue
class node_category_api,node_transaction_api,node_summary_api,node_category_service,node_transaction_service,node_category_schema,node_transaction_schema,node_common_schema,node_summary_schema toneAmber
class node_category_repo,node_transaction_repo,node_sqlite_layer,node_sqlite_store toneMint
class node_web_ui,node_web_logic,node_web_style toneRose
```

## Components

### Entry points

- [FastAPI runtime](https://github.com/prestonwanttorevenge/expense-management/blob/main/app/main.py): `app/main.py`
- [REST routers](https://github.com/prestonwanttorevenge/expense-management/tree/main/app/api/v1): `app/api/v1`
- [Service dependencies](https://github.com/prestonwanttorevenge/expense-management/blob/main/app/api/deps.py): `app/api/deps.py`
- [Problem errors](https://github.com/prestonwanttorevenge/expense-management/blob/main/app/core/exceptions.py): `app/core/exceptions.py`

### Ledger domain

- [Category API](https://github.com/prestonwanttorevenge/expense-management/blob/main/app/api/v1/categories.py): `app/api/v1/categories.py`
- [Transaction API](https://github.com/prestonwanttorevenge/expense-management/blob/main/app/api/v1/transactions.py): `app/api/v1/transactions.py`
- [Health and summary API](https://github.com/prestonwanttorevenge/expense-management/blob/main/app/api/v1/summary.py): `app/api/v1/summary.py`
- [Category service](https://github.com/prestonwanttorevenge/expense-management/blob/main/app/services/categories.py): `app/services/categories.py`
- [Transaction and summary service](https://github.com/prestonwanttorevenge/expense-management/blob/main/app/services/transactions.py): `app/services/transactions.py`
- [Category schemas](https://github.com/prestonwanttorevenge/expense-management/blob/main/app/schemas/category.py): `app/schemas/category.py`
- [Transaction schemas](https://github.com/prestonwanttorevenge/expense-management/blob/main/app/schemas/transaction.py): `app/schemas/transaction.py`
- [Shared API schemas](https://github.com/prestonwanttorevenge/expense-management/blob/main/app/schemas/common.py): `app/schemas/common.py`
- [Summary schema](https://github.com/prestonwanttorevenge/expense-management/blob/main/app/schemas/summary.py): `app/schemas/summary.py`

### Persistence

- [Category repository](https://github.com/prestonwanttorevenge/expense-management/blob/main/app/repositories/categories.py): `app/repositories/categories.py`
- [Transaction repository](https://github.com/prestonwanttorevenge/expense-management/blob/main/app/repositories/transactions.py): `app/repositories/transactions.py`
- [SQLite setup](https://github.com/prestonwanttorevenge/expense-management/blob/main/app/db/sqlite.py): `app/db/sqlite.py`
- **SQLite ledger**

### Presentation

- [Ledger dashboard](https://github.com/prestonwanttorevenge/expense-management/blob/main/app/static/index.html): `app/static/index.html`
- [Dashboard behavior](https://github.com/prestonwanttorevenge/expense-management/blob/main/app/static/app.js): `app/static/app.js`
- [Dashboard styling](https://github.com/prestonwanttorevenge/expense-management/blob/main/app/static/app.css): `app/static/app.css`

### Other components

- **Ledger user**
- **API client**

## Connections

- Ledger user → Ledger dashboard: uses (evidence: `README.md`)
- Ledger dashboard → Dashboard behavior: loads (evidence: `README.md`)
- Dashboard behavior → FastAPI runtime: HTTP requests (evidence: `README.md`)
- API client → FastAPI runtime: HTTP requests (evidence: `README.md`)
- FastAPI runtime → REST routers: mounts (evidence: `app/main.py`)
- FastAPI runtime → Problem errors: registers handlers (evidence: `app/main.py`)
- REST routers → Category API: routes (evidence: `app/api/v1/__init__.py`)
- REST routers → Transaction API: routes (evidence: `app/api/v1/__init__.py`)
- REST routers → Health and summary API: routes (evidence: `app/api/v1/__init__.py`)
- Category API → Service dependencies: injects service (evidence: `app/api/v1/categories.py`)
- Transaction API → Service dependencies: injects service (evidence: `app/api/v1/transactions.py`)
- Health and summary API → Service dependencies: injects service (evidence: `app/api/v1/summary.py`)
- Service dependencies → Category service: constructs (evidence: `app/api/deps.py`)
- Service dependencies → Transaction and summary service: constructs (evidence: `app/api/deps.py`)
- Category API → Category service: calls (evidence: `app/api/v1/categories.py`)
- Transaction API → Transaction and summary service: calls (evidence: `app/api/v1/transactions.py`)
- Health and summary API → Transaction and summary service: calls (evidence: `app/api/v1/summary.py`)
- Category API → Category schemas: validates output (evidence: `app/api/v1/categories.py`)
- Transaction API → Transaction schemas: validates payload (evidence: `app/api/v1/transactions.py`)
- Health and summary API → Summary schema: returns shape (evidence: `app/api/v1/summary.py`)
- Category schemas → Shared API schemas: uses helpers (evidence: `app/schemas/category.py`)
- Transaction schemas → Shared API schemas: uses metadata (evidence: `app/schemas/transaction.py`)
- Category service → Category repository: calls (evidence: `app/services/categories.py`)
- Transaction and summary service → Transaction repository: calls (evidence: `app/services/transactions.py`)
- Transaction and summary service → Category repository: checks category (evidence: `app/services/transactions.py`)
- Category service → Problem errors: raises domain errors (evidence: `app/services/categories.py`)
- Transaction and summary service → Problem errors: raises domain errors (evidence: `app/services/transactions.py`)
- Category repository → SQLite setup: uses SQL helpers (evidence: `app/repositories/categories.py`)
- Transaction repository → SQLite setup: uses SQL helpers (evidence: `app/repositories/transactions.py`)
- FastAPI runtime → SQLite setup: initializes database (evidence: `app/main.py`)
- SQLite setup → SQLite ledger: creates and configures (evidence: `app/db/sqlite.py`)
- Category repository → SQLite ledger: reads and writes (evidence: `app/repositories/categories.py`)
- Transaction repository → SQLite ledger: reads and writes (evidence: `app/repositories/transactions.py`)
- Dashboard behavior → Dashboard styling: renders styled UI (evidence: `README.md`)
- Dashboard behavior → Ledger dashboard: updates dashboard (evidence: `README.md`)
