Building Finance System

Building Finance System

Personal finance aggregator: Cash, and an audit trail - Part 18

~7 min read Everything the app tracks so far lives somewhere with an API, or at least a login: banks through TrueLayer, Hargreaves Lansdown through its website, and loans typed in by hand as manual accounts. The one pot of money it couldn't see was the physical kind - the notes and coins in a wallet or a drawer. Four commits close that gap and then answer a question it raised: when a balance changes, why? This post covers the cash account type (add full cash tracking account type, reduce cash d
Andrew Townsend
Andrew Townsend
6 min read
Building Finance System

Personal finance aggregator: Making the nightly sync boring - Part 17

~9 min read The goal of a nightly job is to be boring. Nothing about it should be worth reading about. By early October the sync was no longer a script I ran by hand (post 3) but a multi-user, multi-provider pipeline, and getting it to quiet took a run of unglamorous commits. This post gathers them, from systemd units to log retention to two small test fixes. If the earlier posts were about adding capabilities, this one is about the failure modes that appear once the capabilities are live. Mo
Andrew Townsend
Andrew Townsend
5 min read
Building Finance System

Personal finance aggregator: Savings projections - Part 16

~8 min read Everything so far has looked backwards: what I spent, what I owe, what the balance was. The savings and projection commit and its follow-up (build on savings add anni date) look forward. The Savings page takes any savings account - synced or manual - and projects its balance twelve months out, given an interest rate and a monthly contribution. It's a small amount of maths, and nearly all of the interest is in making the assumptions explicit, so this post is mostly about those. The
Andrew Townsend
Andrew Townsend
5 min read
Building Finance System

Personal finance aggregator: Budgets - Part 15

~9 min read Categorised spending answers "where did it go?". A budget answers the more useful question, "am I on track?". This post covers the Budgets page, built across five commits between 1 and 5 October, and extended in mid-October with a 50/30/20 view and a richer category page. Nearly all of it reuses machinery from post 12, which is the point - the interesting new decision is about time, not categories. A month, but whose month? A budget needs a period, and the obvious period is the c
Andrew Townsend
Andrew Townsend
7 min read
Building Finance System

Personal finance aggregator: Hargreaves Lansdown, with no API - Part 14

~9 min read The project's very first description listed a stretch goal: Hargreaves Lansdown, for the investment side of the picture. Post 8 assumed that meant a CSV import. It didn't turn out that way. This post covers the commits that made HL a real provider, and mostly it's about how an integration with no API, no OAuth and a real lockout risk changes the design you'd copy from TrueLayer. What's different about HL TrueLayer gave me an OAuth flow, a refresh token, and an API. Hargreaves Lan
Andrew Townsend
Andrew Townsend
5 min read
Building Finance System

Personal finance aggregator: Periods, charts, and a phone-sized UI - Part 13

~9 min read With real categories (post 12) the Home and Transactions pages finally had something worth slicing. This post covers the next batch of changes, mostly 30 September and 1 October: choosing a reporting window, charting balances over time, making the whole app usable on a phone, and a surprisingly instructive detour through deleting a transaction. The theme is that each change started as the obvious implementation and had to be corrected once it met real data. Rolling windows instead
Andrew Townsend
Andrew Townsend
6 min read
Building Finance System

Personal finance aggregator: Rule-based categorisation - Part 12

~10 min read The category column has been in the transactions table since post 4. For two weeks of commits it held nothing, and the Home page's "Spending by category" chart ran on a constant called SPEND_BY_CATEGORY (post 5). This is the post where that finally became real. It's the biggest single feature in the project so far - the first commit alone is a large one - and most of the interesting decisions are about what not to store. The shape: three sources, one precedence order I wanted to
Andrew Townsend
Andrew Townsend
5 min read
Building Finance System

Personal finance aggregator: Seeing everything in one place - Part 11

~9 min read By post 8 the app could pull balances and transactions from every linked bank. What it couldn't do was make that data legible - or hold the parts of my financial picture that no bank API will ever give me, like a car loan. This post is a run of smaller commits, spread over 28-29 September, that were each about the same thing: making the Accounts and Home pages answer "what do I actually have, and what do I owe?" without squinting. It's less a single design story than five related f
Andrew Townsend
Andrew Townsend
5 min read
Building Finance System

Personal finance aggregator: One storage tree per user - Part 10

~8 min read Once identity-system was putting a user id on every request, one assumption baked into the app from post 4 became visibly wrong. Everything - the SQLite database, the OAuth refresh tokens, the fetched JSON - lived in one shared storage/ directory, because there had only ever been one person. The moment a second account could log in, they'd see the first account's banks. This post is about how I fixed that, and why I picked the less clever of two obvious designs. It's three commits
Andrew Townsend
Andrew Townsend
5 min read
Building Finance System

Personal finance aggregator: Handing authentication to identity-system - Part 9

~8 min read Post 6 ended with a login system I was reasonably pleased with: Argon2id passwords, opaque server-side sessions, TOTP two-factor with recovery codes, a password-change form that borrowed login() to verify the current password. It had also, by the end of that post, hit two gaps in the library underneath it - no way to update a user's name or email, and no built-in current-password check - that I'd worked around rather than fixed. The next day I deleted all of it. This post is about
Andrew Townsend
Andrew Townsend
4 min read
Building Finance System

Personal finance aggregator: Account balances and disconnecting banks cleanly - Part 8

~10 min read The next two pieces of this project both came from the same question: does the app actually reflect the full state of my accounts, in both directions - what's currently in them, and which ones I've actually chosen to keep connected. This post covers pulling real balances into the dashboard, and building a way to disconnect a bank that doesn't leave stale data lying around pretending to be current. Balances were already paid for TrueLayer's Data API has balance endpoints - /data/
Andrew Townsend
Andrew Townsend
7 min read
Building Finance System

Personal finance aggregator: Keeping data fresh: manual sync, resilience, and real stats - Part 7

~10 min read Everything up to this point assumed the nightly sync just works. It mostly does - right up until one bank connection has a problem, at which point the version of fetch() I'd had since the very first CLI prototype turned "one bank's data is temporarily unavailable" into "nobody's data updates tonight." This post is about the sync loop growing up: a manual trigger for when 3am is too long to wait, failure isolation so one bad connection can't take the rest down with it, error message
Andrew Townsend
Andrew Townsend
7 min read