Lega Finance APP

A chat-first personal finance app for Indonesian users — log expenses, income, transfers, budgets, and savings goals just by typing a sentence, then confirm with a swipe. Built as a mobile-first PWA on a double-entry ledger, with a self-hosted AI model doing the reading and the backend doing all the math.

Tech Stack :
Docker
Lega Finance APP preview 1

Overview

Lega is a personal finance tracker where the chat is the main screen. Instead of filling in forms, you write what happened — "abis tf 300rb ke ibu buat topup pulsa" or "ngeluarin 150rb, obat 50, makan 70, minum 30" — and the app turns it into structured entries, shows the exact impact on your balances, and only saves once you confirm. A companion dashboard gives the bigger picture over the same data.
It is built mobile-first as an installable PWA (IDR, Bahasa Indonesia, Asia/Jakarta), because a phone is where money is actually spent.
Key Features

Chat-first entry

  • Natural-language logging of expenses, income, transfers, top-ups, and card payments, including several entries from a single sentence
  • Every entry keeps three separate details: the category, the merchant (who or where), and the note (what it was for, in your own words)
  • Ambiguous requests (e.g. "BCA" matching two wallets) are clarified, never guessed
  • Named, pinnable, and archivable conversations, with quote-reply to a specific earlier message

Confirm before anything is saved

  • The AI only drafts — it never posts. A draft opens in a bottom sheet showing the amount and the impact first
  • Money writes are committed with a deliberate swipe-to-confirm, and a confirmation submitted twice still produces exactly one transaction
  • Drafts can be edited before confirming; the backend re-validates and recomputes the impact

Wallets, budgets, goals, and simulations

  • Multiple wallets (cash, bank, e-wallet, credit card) with correct handling of card debt and bill payments
  • Monthly budgets per category with clear "over budget" warnings in words, not just color
  • Savings goals using virtual allocations that never inflate net assets
  • "What if" simulations that never touch real data until you apply the plan
  • Spending summaries drawn as labelled bars inside the chat, plus CSV export

Mobile & PWA

  • Installable, with a service worker that caches only the static shell — never finance or chat data
  • Composer that stays above the keyboard, safe-area aware, 44px touch targets, and no horizontal scroll from 320px up
  • Offline never fakes success: unsaved drafts are marked as such and are never auto-posted

Tech Stack

  • Frontend: Next.js (App Router), React, MUI, built from a set of approved design boards
  • Backend: FastAPI (Python), SQLAlchemy, Alembic migrations
  • Database: PostgreSQL, with the schema kept portable to MariaDB
  • AI: Self-hosted Qwen model served through vLLM (OpenAI-compatible, tool calling), behind a swappable adapter
  • Auth: Email + password with Argon2id, server-side sessions in an httpOnly cookie, and login throttling
  • Infra: Docker, nginx, systemd, GitHub Actions deploys with automatic health-check rollback

Highlights

  • A true double-entry ledger: every transaction sums to zero, so transfers are never counted as income or expense, card payments never double-count spending, and opening balances are not income.
  • The LLM never computes money. It only proposes structured tool calls; the backend authorizes, validates, and calculates with tested functions. Receipts and pasted text are treated as data, never instructions.
  • Privacy by design: user text stays on a self-hosted AI server rather than a third-party provider, and secrets never reach the browser — the PWA only talks to its own backend.
  • Nothing is silently deleted: corrections create a traceable reversal plus an audit event, and fixing a wrong category label moves no money.
  • Hard per-user isolation on every API, enforced and covered by a large automated backend test suite.