← All writing

WRITING

Rewriting a live fintech platform one piece at a time

4 Nov 2026 · 3 min read

Between late 2025 and mid-2026 I led the rewrite of the platform I work on: the system investors use to put money into startups, and that the back office uses for onboarding, signatures, valuations and quarterly reports. We were two engineers, down from six when I joined. I proposed it, planned it and wrote most of the code.

What I wanted to avoid was building a new system for a year, switching everything over on one Friday, and spending Monday finding out which investor’s numbers were wrong. So we moved it over in stages, and each stage had to be useful on its own.

Step 1: a new UI on the old backend

The first thing people saw was a new admin app. It lived on its own domain, talked to the old backend, and the old version stayed up on another domain, so people could use whichever they liked.

Over a few months, fewer and fewer people opened the old one, until nobody did. That got the team a better interface early, and it meant I learned what every screen really needed by rebuilding it, not by reading old code.

Step 2: a new schema, filled by a script

The old database had grown over eight years of different people’s ideas: columns that duplicated data held elsewhere, fields nothing used, four overlapping tables describing who is connected to whom. I redesigned the schema around how the product was actually used, and it went from 154 tables to 101. The four relationship tables became one, some many-to-many tables became JSON lists, and document files moved to one model with named slots.

The new schema was filled by an ETL command that read the old MySQL database and wrote the new Postgres one in about 30 ordered steps: reference data, users, KYC, startups, investments, relationships, attachments and so on. I ran it against copies of production over about three months, and the script ran many times.

Two Postgres details cost me the most time. Clearing tables with TRUNCATE ... CASCADE follows foreign keys further than you expect: on a local copy, truncating the relationships table chained through users and emptied investments. A plain DELETE FROM per table, in the right order, did what I meant. And when you insert rows with explicit ids, Postgres doesn’t move the id sequence along, so the next normal insert collides with an existing id. The fix was to reset every sequence after loading:

def sync_sequences(cursor):
    cursor.execute(
        "SELECT table_name FROM information_schema.columns "
        "WHERE table_schema = 'public' AND column_name = 'id'"
    )
    for (table,) in cursor.fetchall():
        cursor.execute(
            f"SELECT setval(pg_get_serial_sequence('{table}', 'id'), "
            f"COALESCE((SELECT MAX(id) FROM {table}), 1))"
        )

It ran twice: once before the steps that create rows with automatic ids, and once at the end.

Step 3: check the numbers before anything switches

For money, “it looks right” isn’t good enough. I ran the ETL on my machine against copies of production, pointed a second copy of the new admin app at the result, and compared it with the old system: portfolio KPIs, valuations, investor positions. Every difference either got fixed in the script or written down as a change we meant to make, and the script was run again after every fix.

Step 4: the investor app, then the switch

By then the new backend and the admin app lived in one repository, so the investor-facing app went on top of it last, with everything it needed already in place. About seven months in, we switched over: the ETL ran for real once, the apps pointed at the new backend, and the old AWS setup was switched off afterwards. Hosting costs dropped by about 95%.

Once every environment was migrated, we deleted the ETL command. Keeping a 2,700-line script for a database that no longer exists only invites someone to run it.

How two people managed it

A lot of the typing was done by coding agents, which only works with some structure around it. Every bigger change started as a written spec and a plan, the tests ran on every pull request, each pull request got a preview environment with a copy of production data, and nothing merged without an automated review on top of ours. Having everything in one repository helped the agents a lot.

What I’d do differently

On day one, I’d write a script that records the key numbers from the old system alone. It would have doubled as a description of what “correct” meant before I started changing anything.

I’d also turn the switch-over checklist into a script with a dry-run mode. The switch went fine, but the checklist lived in a document, and the practice runs and the real run should have been the same command.