The problem
Money here doesn’t live in one place. A typical month moves through cash, a bank account, and mobile money like bKash, in BDT, alongside budgets, savings targets, loans to and from people, and a few investments. Most tools model one of those well and ignore the rest.
Finox puts all of it in one ledger: every transaction belongs to a wallet, every wallet rolls up into net worth, and every module feeds the same reporting layer.
Constraints
The constraints shaped more decisions than the features did.
- One engineer, alongside a full-time job. Anything that needed babysitting was a liability.
- A near-zero infrastructure budget: the API runs on a single 256 MB Fly.io machine in Singapore, Postgres is managed on Supabase, and the frontends are static deploys on Vercel.
- Subscription billing through Paddle, behind a 14-day free trial that asks for no card up front.
- Real multi-device use: people open it on a phone and a laptop at once, and install it as a PWA.
Architecture
A NestJS 11 API sits behind separately deployed frontends: the Angular 21 user app, an Angular admin portal, and an Astro marketing site. Each frontend ships on its own schedule; the API deploys from CI whenever its folder changes on main, and Prisma migrations run as the Fly release step, so a failed migration never goes live.
A GitHub Action takes a nightly pg_dump into a private repository and keeps 30 days — cheap, boring, and restorable without a vendor. About nine scheduled jobs handle trial emails, push reminders, and digests.
The same API and sign-in now also serve a second product, Finox Business — an order and delivery platform for online sellers — which is the best evidence the boundaries held up.
Schema decisions
The schema has grown to 40 models over 45 migrations. A handful of early decisions carried most of the weight:
- Money is always Decimal(12, 2), never a float. Rates are Decimal(5, 2). Rounding bugs in a finance app are trust bugs.
- Every domain row is scoped by userId with cascading deletes, so deleting an account is one statement and there is no orphaned data to reason about.
- Categories have a nullable userId: null means a system default, set means user-defined. One table, one query, no copy-on-signup.
- Wallets are an Account model with an opening balance, credit limit, and an “include in net worth” flag. Transfers are their own AccountTransfer record; an optional fee becomes a real linked transaction, so it shows up in spending reports instead of vanishing.
- Hot queries are covered by composite indexes — transactions by (userId, date) and (userId, type).
- When subscriptions outgrew columns on User, I moved them to a Subscription table keyed by (userId, product) using expand/contract: the old columns are frozen, not dropped, until the new table has proven itself in production.
amount Decimal @db.Decimal(12, 2)
@@index([userId, date])
@@index([userId, type])Why refresh-token rotation, not a plain JWT
A single long-lived JWT is easy to build and impossible to take back: if it leaks, it is valid until it expires, and “log out this device” is a lie. I wanted short-lived credentials plus sessions I could actually revoke.
Access tokens live for 15 minutes. The refresh token lives for 7 days in an HTTP-only cookie, and each one maps to a server-side session row by its jti — the database stores only a SHA-256 hash of the token.
- Every refresh rotates the token with a compare-and-swap update on the stored hash, so two concurrent refreshes can’t both win; the loser retries.
- The previous token stays valid for a 45-second grace window. Without it, several tabs waking from sleep and refreshing at the same moment would log each other out; the window is short enough not to meaningfully weaken theft detection.
- Logout deletes that one session; a password reset deletes all of them.
- Around it: bcrypt for passwords, a global rate limit with tighter 5–10 requests/minute on auth routes, helmet, a CORS allowlist, and admin impersonation through a separate two-minute, single-purpose token.
Frontend
The user app is zoneless Angular with signals throughout — state lives in signal-based services rather than a store library, which kept a solo codebase small enough to hold in my head.
- Nine Highcharts report views — cash flow, net worth, budgets, categories, tags, debts, savings, investments, and a monthly summary — with export and public read-only share links.
- 17 lazy-loaded routes, and a service worker that recovers when a deploy removes the lazy chunks an open tab still expects, instead of failing silently.
- English and Bangla via a small custom i18n service, plus an HTTP interceptor that tags only our own API requests with Accept-Language so error messages come back in the user’s language.
What the surfaces share — and what they don’t
They share one API, one design language (PrimeNG’s Aura theme plus Tailwind), and one sign-in. The refresh cookie is Partitioned (CHIPS) and keyed to the top-level site, so signing in once carries across every product subdomain without building an SSO handshake.
They do not share component code. Each Angular app has its own shared folder, and when one app needs something another already has, I port it. For one developer shipping apps on independent schedules, that was faster than standing up and versioning a library. The cost is real, though: every fix has to be carried by hand, which is why it tops the list below.
What I’d do differently
- Extract a shared Angular library for UI, auth, and HTTP now that there is more than one consumer, instead of porting fixes by hand.
- Add refresh-token reuse detection: today a stale token outside the grace window is simply rejected; it should revoke the whole session family as a likely theft signal.
- Put tests and lint in CI. The API has a handful of specs and deploys are gated only by the build — fine for a prototype, not for money.
- Add a scheduled cleanup for expired sessions, and finish the expand/contract migration by dropping the frozen subscription columns.
Want to see it running?
View the live product
