How ananthakumaran/paisa works
Project Type and Purpose
• Paisa is a full-stack personal finance manager written in Go (core/business logic & servers) plus SvelteKit/TypeScript (web & desktop UIs).
• It exposes three “faces”:
– CLI commands (cmd/)
– Desktop GUI via Wails (desktop/)
– Web UI via SvelteKit (src/ + web/web.go)
• All three reuse the same monolithic core in internal/ (ledger parsing, accounting, caching, scrapers, services, taxation, XIRR).
File‐Structure Analysis
• Top‐level entrypoints
– cmd/ – CLI commands: init, serve, update, version
– desktop/ – Wails-powered desktop app (app.go, main.go, plus embedded frontend runtime)
– src/ + web/web.go – SvelteKit web frontend + Go static-asset server
• Core logic (internal/)
– internal/server/ – HTTP handlers & router for JSON API
– internal/model/, internal/ledger/, internal/accounting/, internal/config/, internal/cache/, etc.
– internal/scraper/ – external data fetchers (mutual funds, NPS, stocks)
• Supporting files: Dockerfiles, Makefile, fixtures/tests, docs, brand assets
Key README Insights
• “Builds on top of ledger CLI” – the core sometimes shells out to the ledger binary
• Provides demo URL, open-source under AGPL
a. Main Components
1. User Interfaces
• CLI (Go cmd/)
• Desktop App (Wails: Go ↔ Svelte runtime)
• Web App (SvelteKit + Go server)
2. API Layer
• HTTP JSON API (internal/server/) – consumed by web & desktop
3. Core Business Logic
• Configuration & schema (internal/config/)
• Ledger parsing & command integration (internal/ledger/, external ledger binary)
• Accounting domain (internal/accounting/, internal/model/)
• Prediction, XIRR, taxation, services (internal/prediction/, internal/xirr/, internal/service/, internal/taxation/)
• Scrapers (internal/scraper/)
• Cache layer (internal/cache/)
4. External Dependencies
• Ledger-CLI binary
• Third-party data sources (APIs, HTML endpoints for mutual funds, stock quotes)
b. Relationships & Data Flows
– CLI commands call core logic directly (Go function calls + occasional ledger-CLI subprocess).
– Desktop UI→Wails runtime→Go bindings→core logic→returns JSON/structs→UI.
– Web UI→HTTP JSON API (internal/server)→core logic→data→JSON response.
– Core logic may call ledger-CLI, scrapers, read/write local files (ledgers, caches).
c. Architectural Patterns & Principles
– Layered Monolith: clear separation between UI, API/controller (internal/server), domain/services (internal/*), infrastructure (filesystem, subprocess, HTTP fetch)
– Reuse of core business logic across multiple front-ends
– Single codebase, multi-target build (CLI, desktop, web, Docker)
d. Key Technologies & Frameworks
– Go (backend, CLI, API, desktop glue)
– SvelteKit & Vite (web frontend)
– Wails (desktop wrapper)
– Ledger-CLI external tool
– Docker / Nix for reproducible builds