A PHP monolith, one Go service, and a WordPress nobody can see: how BiziMoney is built
BiziMoney is a personal-finance app for Romanian users. You track accounts, budgets, goals and recurring payments. You import bank statements, use loan calculators, and chat with an AI assistant that knows your numbers. Inside the codebase it is called Frank. The logged-in part of the product is called Banu.
This post covers the whole path: what happens when a request reaches the server, where the money is stored, how the AI chat works without being able to damage the books, and how a WordPress install runs the blog while staying hidden from the internet. Along the way I explain why each piece looks the way it does.
Short version:
- A Symfony monolith owns the money, using double-entry bookkeeping and integer amounts.
- One small Go service handles the streaming AI chat. It can read your data through read-only views, but it can only change data through the same API the UI uses.
- WordPress is where blog posts get written, but only VPN and allowlisted IPs can reach it. Symfony serves the blog to readers.
- It all runs as one Docker Swarm stack on a single VPS, deployed without downtime.
- The whole thing is built so I don’t have to log in: data comes in through imports and schedules, and the app reaches me by email and through my own AI agents.
Why I built it
I didn’t want another app I have to open every day.
Most personal-finance tools want your attention. You open them, check the dashboard, enter yesterday’s coffee. I wanted the opposite: something simple, easy to customize, and fully automated. Data should come in on its own, and the app should come to me when something matters: a budget about to overflow, a payment due, a monthly report in my inbox.
That idea shaped the product more than any framework choice:
- Imports, not typing. Bank statements come in as CSV, TSV, XLS or XLSX. You map the columns once. Then transactions are matched against earlier descriptions and categorized automatically.
- Recurring things handle themselves. Scheduled payments (rent, subscriptions, loan installments) turn into real entries every hour. Exchange rates are pulled from ECB / Frankfurter four times a day, so balances in several currencies stay correct without any action from me.
- Notifications instead of dashboards. When a budget line crosses a threshold, an email goes out, once per line, month and threshold, so the inbox doesn’t fill up.
- Reports by email. Ask the assistant for a report and you get a PDF in your inbox.
- Agents, not clicks. Personal access tokens and an MCP server let my own tools (Claude Code, Cursor, scripts) read and write my data. I don’t need to open the UI at all.
“Easy to customize” also explains the stack. I own every layer: the API, the AI tools, the containers, the deploy. If I want a new alert or a new import format, I can add it in an afternoon without a vendor’s roadmap getting in the way.
I didn’t start from zero. For years I used Home Budget, and I liked it a lot, especially family sync: everyone in the household logging expenses into the same budget. But after more than two years and thousands of records, syncing between family members kept breaking. That was the end of it for me.
Next came Wallet by BudgetBakers. It’s a great app, and bank sync was the feature I loved. But for me it had too much: lots of features I didn’t need, all asking for my attention. And it still lacked the one thing I wanted most, which was understanding my money without opening the app.
The big picture
Everything runs on a single VPS, as a Docker Swarm stack:
app_main_backend: Symfony on FrankenPHP. It owns the domain, the API, auth, and server-rendered pages. It runs as 2 replicas.app_main_backend_jobs: the same image in “jobs” mode. It runs Messenger workers, the Symfony Scheduler and cron.app_chat_backend: a small Go service for the AI chat, PDF reports and the MCP server.- The Banu SPA: React, built into the PHP image and served from the same origin.
wp: WordPress, used only for writing blog posts.gotenberg: Chromium in a box that turns HTML into PDF.- A shared MariaDB + Redis stack on its own network.
A request passes through four layers: Cloudflare → Traefik → Caddy (inside FrankenPHP) → Symfony or Go. Caddy does the last split. /api/v1/chat* and /api/v1/wallet/reports* go to Go. Everything else goes to Symfony.
The core: a Symfony monolith with real bookkeeping
The heart of BiziMoney is a plain Symfony app: PHP 8.5, Symfony 7.4, Doctrine ORM 3, MariaDB. It owns users, accounts, transactions, budgets, goals, categories, labels and imports.
Double-entry, even for a consumer app
Every transaction is stored as two entries, a debit and a credit. A transfer between your current account and your savings account is one transaction with two entries, and both balances stay correct by construction. Income and expenses work the same way, against category-like accounts.
Why use real bookkeeping in a consumer app?
- Balances are derived, not stored and hoped for. Nothing gets out of sync quietly.
- Transfers are free. No special “transfer” flag that every report has to remember.
- Money is an integer. Amounts live in a
Moneyvalue object as integer minor units (bani, cents). There are no floats anywhere near money.
Accounts and transactions use Single Table Inheritance (Income, Expense, Transfer), and a BookingEventProcessor handles side effects when something is booked.
One API for everything
All features go through /api/v1: input DTOs, Symfony Validator, and an OpenAPI document generated by NelmioApiDoc. The SPA uses it. The AI chat uses it for writes. External agents use it. There is one validation path, one permission model and one audit trail.
Auth is a JWT in an HttpOnly cookie with session state in Redis, plus Google OAuth and personal access tokens for agents (details in the security section).
Frontend: from Twig widgets to a React SPA
The UI started the way many Symfony apps do: Twig templates with Webpack Encore widgets, and at different points Vue and Stimulus on top. It worked, but each new screen was a negotiation between three ways of doing things.
Today the logged-in product is Banu, a standalone SPA: React 19, Vite 8, TypeScript, Tailwind, shadcn-style components on Radix UI, Recharts for charts. It talks only to /api/v1 on the same origin with cookie auth, so there is no CORS and no token handling in JavaScript.
Twig didn’t go away completely. Marketing pages, auth screens and the loan calculators are still rendered on the server, because that’s what search engines and first visits need.
The move wasn’t a sudden decision. For a long time, what held me back was the learning curve: I’m a backend developer, and modern frontend frameworks and their tooling were a big investment. This year, coding agents got good enough to shrink that curve, and that was enough to make the switch.
Why one Go service, and only one
For a long time everything was PHP. The one thing that pushed me out was streaming LLM answers. Long-lived SSE connections, several upstream calls per message, tool calls in a loop: that work suits a small concurrent runtime much better than PHP request/response workers.
So there is exactly one Go service: Go 1.24, very few dependencies (MySQL driver, JWT, Redis, zap, a mail library). It handles the chat, the PDF reports and the MCP server. Nothing else.
A few details that made it fit in cleanly:
- Same origin, no second domain. Caddy inside the PHP container forwards chat routes to Go. SSE needs care: gzip is off,
flush_interval -1, and Traefik flushes every millisecond so tokens reach the browser as they are generated. - Go validates logins but never creates them. The Go service ports Symfony’s JWT cookie authenticator and reads the same Redis keys. Login, refresh and logout stay in PHP. To keep the two implementations honest, both test suites run against shared “golden” JWT fixtures: PHPUnit and
go testcheck the same tokens. - Mistral as the model. A small model routes the request and does web search. A large model writes the answer. Each conversation has a 100k-token budget. When it fills up, the service summarizes and continues in a child chat.
“The model never writes the ledger”
This is the rule I care about most. An LLM can be wrong, can be manipulated through prompt injection, and is confident either way. It should not be able to corrupt anyone’s books.
So the chat service follows a strict split:
- The model never sees SQL and never chooses a
user_id. Tools take business arguments. The user comes from the authenticated session. - Reads go through views. Doctrine migrations define SQL views over the ledger. Go reads them with a read-only MySQL user (
chat_ro). Even a bug in a tool cannot write. - Chat state is kept apart. A second pool (
chat_rw) can write only tochat_*tables: conversations, messages, tool-call logs. - Writes go back through Symfony. When the assistant creates a category, a goal or a budget, Go calls the Symfony wallet API with the user’s own cookie. That runs the same validation, permissions and audit log as if the user had clicked the button.
On top of that sit the product guardrails. Chat is Pro-only, there is an admin kill switch, a limit of 10 messages per minute and 2 concurrent streams, and a monthly quota of a few million tokens. Before any tool runs, a small model checks that the question is about personal finance. Anything else (weather, recipes, “ignore previous instructions”) gets a fixed refusal in Romanian. That text is a Go constant, not model output.
Built for agents from the start
Because one API serves everything, opening it to outside agents took little extra work:
- Personal access tokens (
bzm_pat_…) with read or write scope. - OpenAPI at
/api/v1/openapi.json. - A remote MCP server at
/api/v1/mcpthat exposes the same tools as the in-app chat. MCP write tools forward the token to Symfony, so PHP’s scope checks still apply. llms.txtand an agentSKILL.md, so coding assistants know how to use it.
This ties back to the opening goal: I can ask Claude Code “what did I spend on groceries last month?” or “create a budget for December” without opening BiziMoney.
A WordPress the internet can’t reach
The blog needed a familiar editor. I didn’t want WordPress exposed to the public internet. The answer was to use WordPress only as an editing backend.
- An editor writes in WordPress at
wp.bizimoney.ro. - On save, WordPress calls a webhook on Symfony over the internal Swarm network.
- Symfony queues a
WpContentChangedmessage. A worker pulls users, categories, media and posts from the WP REST API into localwp_*tables. - Symfony renders
/blogitself, with SEO meta, social previews and a cachedsitemap.xml. Media comes from a shared volume mounted read-only into the PHP container.
An hourly reconcile job and a “sync now” button for the super-admin cover anything the webhook misses.
Readers never touch WordPress. Getting to it at all takes one of two routes:
- Over the VPN. WireGuard plus Pi-hole split DNS resolves
wp.bizimoney.rostraight to the server’s VPN address. The request bypasses Cloudflare and has noX-Forwarded-Forheader. - Through Cloudflare, from an allowlisted IP.
The trick is two Traefik routers for the same hostname, split on whether X-Forwarded-For is present. Each router has its own IP allowlist middleware: one checks the direct VPN address, the other the client IP that Cloudflare forwarded. Anything else gets a 403. One hostname works both ways, and WordPress has no public attack surface.
Infrastructure and delivery
- Docker everywhere. No PHP, Node or Go on the host. A
Makefileis the single entry point:make up,make phpunit,make chat-test. - Compose for development, Swarm for production, on a single VPS.
- Three networks.
reverse-proxy(only what Traefik may route to: PHP and WP), the stack’s default network (internal calls), and an externaldbnetwork. Go and gotenberg are not onreverse-proxy, so the only way in is through Caddy. - One Swarm gotcha: call services by their full Swarm name (
ro-bizimoney-prod_app_main_backend), never by the short Compose name. On shared overlay networks, short names can resolve to another stack’s container. - Zero-downtime deploys. Two PHP replicas,
start-firstupdates, automatic rollback, and a smoke-test script after every deploy. - CI/CD. GitLab CI with a private registry and multi-arch images. Secrets come from Bitwarden Secrets Manager and become Docker secrets.
- Environments. Local (
bizimoney.localhost), nightly (allowlisted, not public), and prod.
Security
A finance app holds data people care about, so security works in layers rather than relying on one big wall.
Edge and network
Cloudflare in front with Full (strict) TLS. Traefik behind it with Let’s Encrypt certificates, HSTS and IP allowlists for private hosts. Only the PHP container and WordPress can be routed to at all. The Go service, gotenberg, MariaDB and Redis are unreachable from outside the server. Gotenberg is locked down further: no JavaScript, it can’t fetch URLs, and output is capped at 500 MB.
Browser hardening
Every HTML page Symfony renders gets a Content Security Policy with a fresh nonce per request: scripts run only if they come from the site itself or carry that nonce, plus a short list of named third parties. The SPA shell has its own static CSP set in Caddy with frame-ancestors 'none' and object-src 'none'. Responses also send X-Content-Type-Options: nosniff and a strict referrer policy. The public contact form is protected by Cloudflare Turnstile instead of a puzzle CAPTCHA.
Sessions that can actually be revoked
- Two HttpOnly cookies: a 15-minute access token and a 7-day refresh token. The refresh cookie is scoped to
/api/v1/auth, so it isn’t sent anywhere else. - Signed with a dedicated
JWT_SECRET, separate from the framework secret. - Refresh rotation: every refresh denylists the old token.
- Real logout. Redis keeps a per-token denylist (
jti) and a per-user “invalidate before” timestamp. Changing your password, or an admin pressing “log out everywhere”, kills every session immediately. - Cookies are
SameSite=Strict, which is what protects the JSON API from CSRF.
Two-factor authentication
Password logins can use TOTP 2FA, and it is required for admins. Secrets are encrypted with libsodium and stored in a separate table, so report queries never see them. Used codes are remembered in Redis to stop replay. A challenge allows 5 attempts and then expires. Recovery codes are stored only as hashes. “Trust this device” cookies all become invalid at once when 2FA settings change.
Deny by default
Every /api/v1 route requires a logged-in user unless it is on an explicit public allowlist. A unit test checks that list, so adding a public endpoint by accident fails CI. Controllers repeat the role check with #[IsGranted] as a second layer. Public endpoints are rate-limited.
Agent tokens
Personal access tokens are stored only as SHA-256 hashes, with a checksum so typos fail fast. They have read or write scopes, need a Pro plan, and can be switched off platform-wide. They cannot reach admin, auth, chat, 2FA, billing or token-management routes, and each one is limited to 120 requests per minute.
The AI boundary
Covered above: a read-only database user on views, writes only through the API, a topic guard before any tool runs, and quotas. One more detail: before earlier assistant messages go into a web search, anything that looks like personal data is removed (IBANs, CNPs, card numbers, amounts).
Audit log
Every wallet action is logged with an owner (whose data) and an actor (who did it, or null for system jobs). Users can see their own trail in the app. When an admin impersonates a user for support, start and stop events mark the session, and everything in between is logged as acting-as.
Secrets
Nothing is kept in the repository. Bitwarden Secrets Manager supplies the values at deploy time and they become Docker secrets.
Backups
The whole database is backed up every day. Uploaded files and generated reports are not backed up, on purpose. They are short-lived: an import file gets processed, a report gets downloaded or emailed, and after that nobody needs them. Data I don’t keep is data that can’t leak.
Built with AI agents
Much of this codebase was written with AI coding agents. The repo has an AGENTS.md, Cursor rules, project skills and a code index (codedb), so an agent starting fresh has the same context I do.
None of that context was there on day one. The agents didn’t get things right from the start, and early on I had to step in and correct them again and again. Each correction turned into better context, and the project skills were built up and restructured over time. Today I rarely have to correct an agent or send it in a different direction. One skill even learns from my corrections and updates the other skills, so the setup gets smarter as the project grows.
Docker and the Makefile helped more than I expected. With one documented command for every action, the agents understood what I wanted, what they were allowed to run, and how to chain the steps into a full workflow.
What I’d do again
- Start with a monolith. Split only where the runtime model really differs. For me that was streaming LLM chat, and nothing else.
- Put the AI behind the same API as the humans. One set of validations and one audit trail.
- Use a private CMS with a public renderer. Editors get WordPress. The internet gets Symfony.
- Use integer money and double-entry from day one. Adding it later is painful.
- Automate the boring parts first. Imports, recurring payments, alerts. That’s what makes an app you don’t have to visit.
Would I change anything? Not right now. The project is still growing, and the to-do list is long: bank sync, sharing with family or a group, custom notifications, and more. That’s where my time goes next.
Try it
BiziMoney is live at bizimoney.ro. If you have questions about any part of this, such as the JWT sharing between PHP and Go, the read-only views, or the Traefik setup, get in touch. Some of them will probably turn into their own posts.