C 6da2946aaf Write the documentation in Simplified Technical English il y a 3 heures
..
src 6da2946aaf Write the documentation in Simplified Technical English il y a 1 heure
static 0e6fc22039 Default a journal entry to its movements il y a 1 heure
templates 0e6fc22039 Default a journal entry to its movements il y a 1 heure
Cargo.toml 70b9992a2d Make kuatia the only crate an application depends on il y a 3 jours
README.md 0e6fc22039 Default a journal entry to its movements il y a 1 heure

README.md

kuatia-dashboard

A read-only visualizer for a Kuatia ledger. It connects to a ledger database (SQLite or PostgreSQL) and serves two views of it:

  • A server-rendered HTML dashboard (Tera templates, htmx for live refresh).
  • A JSON REST API under /api for anyone who wants to build a richer client.

The dashboard only observes the ledger. It never mutates it. Templates, CSS, and htmx are embedded in the binary, so nothing extra is needed on disk at runtime.

Run it

# In-memory demo (seeds accounts/transfers on start):
cargo run -p kuatia-dashboard -- --seed
# open http://127.0.0.1:3000

# Persist to a SQLite file, seed once, then reopen without reseeding:
cargo run -p kuatia-dashboard -- --db sqlite://kuatia.db --seed
cargo run -p kuatia-dashboard -- --db sqlite://kuatia.db

# Point at a PostgreSQL ledger on a custom port:
cargo run -p kuatia-dashboard -- --db postgres://user:pass@host/db --port 8080

--seed populates demo data only when the ledger is empty, so it is safe to leave on; against an already-populated database it is a no-op.

Pages

Path Shows
/ Overview: account count, transfer count, issued per asset
/accounts All accounts with policy, flags, and balances
/accounts/:id One account: balances, postings, and its journal entries
/transfers Recent transfers as journal entries
/events The append-only ledger event log

Each page wraps its dynamic section in an htmx hx-get/hx-trigger="every 3s" element that polls a matching /ui/* route and swaps in the fresh fragment.

/transfers and /accounts/:id draw each entry as its movements: one row per movement, debiting the payer and crediting the owner. ?details=all draws every posting instead, change and offset lines included, with the per-asset conservation totals. The mode is in the URL because the polled hx-get is fixed at page render, so anything held client-side would be wiped by the next swap.

REST API

All amounts are minor-unit strings (the ledger's native Cent form). Clients format them using the decimals from /api/assets.

Method & path Returns
GET /api/assets Asset registry: id, code, symbol, decimals
GET /api/overview Account count, transfer count, total issued per asset
GET /api/accounts All accounts with policy, flags, and balances
GET /api/accounts/:id One account plus its postings and journal entries
GET /api/transfers Recent transfers as journal entries, both sides, each with the caller's reference, metadata, value date and book
GET /api/events The append-only ledger event log

Configuration

Each option is a CLI flag with an environment-variable fallback and a default.

Flag Env var Default Purpose
--db KUATIA_DASHBOARD_DB sqlite::memory: Ledger database URL (SQLite or Postgres)
--host KUATIA_DASHBOARD_HOST 127.0.0.1 Interface to bind
--port KUATIA_DASHBOARD_PORT 3000 Listen port
--seed KUATIA_DASHBOARD_SEED false Seed demo data if the ledger is empty
(n/a) RUST_LOG kuatia_dashboard=info,tower_http=info Log filter