All projects

Koru

A personal and household budgeting app with bank sync, built as event-driven Go services on Kubernetes.

The Koru app overview with a sample workspace: balances, budgets and recent transactions. Desktop view.
koru-budget.com/demo, sample workspace
The Koru landing page on desktop and on a phone. Desktop view. Phone view.
koru-budget.com, the landing page
The Koru tech blog on desktop and on a phone. Desktop view. Phone view.
koru-budget.com, the tech blog

What it is

  • A budgeting app for one person or a whole household: transactions, categories, budgets, savings goals, recurring payments and spending trends, in more than one currency.
  • Shared workspaces with invites, so a couple or family can run one budget together.
  • Connects to your bank over Open Banking (PSD2, through Enable Banking) and imports your transactions.
  • Lets you export or delete your data, and deletion really erases it.

The problem

A budgeting app holds some of the most sensitive data a person has: bank transactions, shared with other people in a household. It has to stay consistent when several people and a bank sync change things at once, and when someone asks for their data to be erased, it has to be gone.

So it is built as a production platform: separate services that own their own data, talk only through events, and can be deployed, rolled back and secured independently.

How I built it

  • Split the backend into six Go services (transactions, budgets, analytics, users, banking, notifications), each with its own PostgreSQL database and its own database role, so one service cannot read another’s tables.
  • Made the services never call each other over HTTP. All communication is events on a RabbitMQ topic exchange, so one service being slow or down does not take the others with it.
  • Wrote a shared Go module for the parts every service needs: the outbox and relay, event envelopes, encryption, auth, idempotency, database access, logging and OpenTelemetry. Each service gets the same guarantees without copying code.
  • Saved every change and the event that announces it in one database transaction, so an event is never lost and never published for a change that rolled back.
  • Encrypted personal data through Vault Transit with a key per workspace or per user, so erasing a workspace means destroying one key, not hunting for rows.
  • Put Keycloak behind its own small proxy that only exposes OIDC discovery, the signing keys and the sign-in flow, and cached validated token claims in Redis so a token is not re-validated on every request.
  • Ran it all on Kubernetes with Istio in ambient mode for strict mTLS between workloads, and deployed everything through ArgoCD from one Kustomize repo.

The interesting parts

An outbox with no broker on the request path

When a request changes data, the service writes the domain rows and an outbox_events row in the same pgx transaction, and never talks to RabbitMQ while the user waits. A relay in the shared module leases a batch of rows with FOR UPDATE SKIP LOCKED, so replicas never claim the same rows, and publishes them as persistent AMQP messages with exponential backoff between retries. If a batch runs past half its lease, the relay hands the rest back instead of racing another replica that may reclaim them. A malformed envelope is a permanent error, not something to retry. On the other side, every consumer applies an event and records its id in processed_events in one transaction, so a redelivered event changes nothing, and a message that keeps failing makes a few laps through a retry queue before it is parked on a dead-letter queue.

Read models that cannot bring deleted data back

Services keep local copies of data they do not own, such as categories, built from events. Events can arrive late or twice, so every snapshot carries a revision and an update only applies when it is newer than the stored row. A category.updated can also land after the category.deleted it came before, so a delete records a watermark and any update at or below it is dropped instead of recreating the row. In analytics, workspace deletion leaves a tombstone, and PostgreSQL advisory locks serialize projection writes with the deletion so nothing slips in while a workspace is being removed.

Erasure by destroying keys

Sensitive fields are encrypted with Vault Transit keys scoped to what owns the data: the workspace for transactions, budgets, goals and imported bank transactions, and the user for pending bank connections, notifications and invites. When staged bank transactions are imported into a shared workspace, they are re-encrypted from the user’s key to the workspace key, and the import refuses to write if a bank re-sync changed the row in the meantime. Deleting a workspace destroys its key, which makes every copy of that ciphertext unreadable at once. Deleting an account destroys the personal workspace key, and the other services purge that user’s rows when the user.deleted event reaches them. Vault is outside the database, so the key is created after the transaction that inserts the workspace commits, and destroyed after the one that deletes it. A pending flag written in that same transaction, plus a background reconciler, retries any Vault call that failed.

Security in layers, from the edge to the mesh

Traffic comes in through Cloudflare and a proxy, then Varnish, which routes to the Next.js frontend or to OpenResty. OpenResty pre-filters tokens for shape and expiry and rate limits in Lua with counters in shared memory, with a stricter limit for signups, and every service still verifies the token signature against Keycloak itself. Inside the cluster, Istio ambient mode enforces strict mTLS across the namespace without sidecars, with only the two entry points left permissive, and a default-deny ingress NetworkPolicy means each pod accepts traffic only from what is explicitly allowed. Keycloak is never exposed directly: an nginx proxy in front of it allows only the realm’s discovery, signing keys and Google sign-in paths and returns 404 for everything else, including the admin console and the master realm. Because nginx matches routes on the normalized path but forwards the raw one, it also rejects encoded slashes, encoded dots and dot segments before routing.

GitOps deployment

  • One Kustomize repository describes the whole cluster: the six Go services and the infrastructure around them, from PostgreSQL and Vault to Keycloak, Varnish and OpenResty.
  • ArgoCD generates an Application for every service and every piece of infrastructure from two ApplicationSets, with automatic pruning and self-healing, so the cluster always matches the repo.
  • Each Go service runs its database migrations as an ArgoCD PreSync job before the new version starts, and a PostSync job bootstraps Vault.
  • Secrets are stored in Git as Bitnami Sealed Secrets, and application keys live in HashiCorp Vault.
  • GitLab CI builds every Go service from shared templates, and a shared promotion job commits each new release to the GitOps repo for ArgoCD to roll out.
  • Istio in ambient mode enforces strict mTLS across the namespace without sidecars, and a default-deny ingress NetworkPolicy means each pod accepts traffic only from what is explicitly allowed.

How it runs

  • All six services are live in production on a Kubernetes cluster.
  • Every service exports telemetry over OTLP to an OpenTelemetry Collector, set up once in the shared module.
  • The frontend pipeline refuses dependency install scripts, verifies npm package signatures and checks that every lockfile entry comes from the official npm registry, and the image runs as a non-root user.