Engineering

How we moved our entire backend from Node to Go in two weeks

Every request, sign-in, background job, and migration moved from Node to Go in two weeks with minimal human intervention.

On October 30 we merged a Go server with an empty route table. On November 13 we deleted our Node backend. In between, every request, background job, and sign-in moved over while couples and their attorneys kept using Neptune and the rest of the team kept shipping on the same codebase.

Neptune helps couples write prenups and plan their estates, so the backend handles payments, attorney bookings, signed agreements, and a lot of personal data. Until this month it was a TanStack Start app on Node: server functions and a Hono REST layer over Drizzle and Postgres, Better Auth for sign-in, and Inngest functions for emails, texts, vendor syncs, attorney payouts, and AI jobs. It was slow to type-check, hard to reason about under load, and it rendered every page on the server for an app that search engines never see.

Rewrites like this usually live in a branch for months and ship in one risky weekend. We couldn’t afford either. So the Go server went to production on day one, doing nothing, and took over one route at a time.

I did it with a fleet of AI agents, alongside my usual job as CTO. The migration was never my main focus. Go also turned out faster: on reads we ran through both backends, the median went from 297 ms to 127 ms. The method is in the compare mode section.

The migration

A front door that passed everything through

First we shipped a Go “front door” in the same container as Node. Go saw every request first and either answered it or passed it to Node on localhost. On day one it passed everything.

Each operation had a mode: Node, compare, or Go. Moving a route meant adding its name to a list in Terraform, and rolling back meant removing it. A second list sent named staff accounts to Go, so we used each Go route for a day before customers did.

Routes by mode

  • Node
  • Compare
  • Go
Share of the routes in the production routing table, by who answered them. Node: Node only. Compare: both ran, Node’s answer went to the user, and Go’s answer was checked against it. Go: Go only. Daily median. The table grew as routes were added to it.
Show the data
DayNodeCompareGo
Oct 3120800
Nov 143.156.50.4
Nov 260.436.82.8
Nov 361.930.57.6
Nov 461.72810.3
Nov 560.29.130.7
Nov 632.78.858.5
Nov 78.42.489.2
Nov 80.50.399.2
Nov 910.398.7
Nov 101.70.298.1
Nov 1130.296.8
Nov 122.30.297.5
Nov 131.6098.4

Most routes started in compare mode: 80% of the table on October 31 and more than half on November 1. From November 8 to 12, it was down to 0.3% of routes. After that, nearly every new route started in Go.

The front door also wrote one log line per request with the operation, status, latency, and servedBy, the backend that answered:

text
operation=getExampleThing status=200 latency_ms=14 servedBy=go

The share of those lines Node still served was our progress bar.

Who answered each request

  • Go
  • Node
Share of production API requests answered by Go and by Node, every 12 hours.
Show the data
PeriodGoNode
Oct 30 PM3.796.3
Oct 31 AM7.692.4
Oct 31 PM3.596.5
Nov 1 AM6.293.8
Nov 1 PM4.595.5
Nov 2 AM4.195.9
Nov 2 PM15.384.7
Nov 3 AM12.787.3
Nov 3 PM24.175.9
Nov 4 AM13.886.2
Nov 4 PM24.275.8
Nov 5 AM25.674.4
Nov 5 PM29.270.8
Nov 6 AM49.750.3
Nov 6 PM28.571.5
Nov 7 AM26.673.4
Nov 7 PM19.680.4
Nov 8 AM7.592.5
Nov 8 PM19.280.8
Nov 9 AM28.971.1
Nov 9 PM35.364.7
Nov 10 AM52.647.4
Nov 10 PM77.122.9
Nov 11 AM82.617.4
Nov 11 PM86.613.4
Nov 12 AM96.93.1
Nov 12 PM98.31.7
Nov 13 AM99.30.7
Nov 13 PM99.80.2

Go and Node split traffic evenly on the morning of November 6. In the last 12 hours, Node answered less than 0.2% of requests.

Compare mode for busy reads

We didn’t move a busy read until production agreed with the port. In compare mode Node answered the user, and for a sample of requests Go ran the same request and we compared the two responses. A mismatch logged the operation and the shape of the difference, never the body, since bodies can hold customer data.

Most mismatches were small: timestamp precision, tied rows in a different order, a null where Node left a field out. A few were bugs in Node that the port had copied. When Node did something odd, we checked whether anyone depended on it before copying it. A read moved to Go after enough real traffic with zero mismatches; for a route called five times a week, we accepted less evidence.

Because both backends handled the same request, compare mode was also our speed test. Each compare log line records both times. From October 30 to November 12, Go was faster on 89% of the requests we compared:

Compared readsNodeGo
Median297 ms127 ms
95th percentile1,529 ms1,084 ms
99th percentile2,320 ms1,688 ms

That’s sampled reads only, not writes or jobs. And not every route got faster: about 6% of the busiest compared routes were slower on Go at the median.

Record and replay for writes, and the edge map

You can’t run a write twice to compare it. So for each write we recorded the request, the database before, and the database after, then replayed the request against Go on a fresh Postgres and compared the rows. The recordings became committed test fixtures, so Go handlers are still checked against what Node did.

The edge map caught more bugs than the tests. Before an agent ported a route, it listed every branch in the Node code: what triggers the branch, and whether Go matches it or differs on purpose. The list went in the pull request. So the agent had to read the Node code end to end before it wrote any Go. Each row gave the Node file and line, what the branch does, the Go test that covers it, and a status: MATCH, or DECISION for a deliberate difference we could reverse later. A made-up example for a route that cancels a consult, with the test column left out:

IdNode file:lineBehaviorStatus
N01consults.ts:42No session answers 401.MATCH
N02consults.ts:48A consult that belongs to someone else answers 404, not 403, so the caller can’t tell it exists.MATCH
N03consults.ts:61A consult less than 24 hours away can’t be cancelled: 409 with the code TOO_LATE.MATCH
N04consults.ts:70If the calendar delete fails, the cancel still succeeds and the error is only logged.MATCH
N05consults.ts:77A second cancel of the same consult answers 200 and sends no second email.MATCH
N06emails/cancel.tsxGo sends the same words in plain HTML, without the React Email layout.DECISION

Rows like N04 are where bugs hid. Nobody thinks to write a test for “a failed calendar delete still cancels the consult,” but the map made the agent find that branch and match it.

Background jobs that sleep for a week

Jobs were harder, because a job can sleep for a week and still be in flight. We moved them to Hatchet, run by our Go worker, one event group at a time:

  1. Dark job. Merge the Go task with no trigger: registered, tested, and doing nothing.
  2. Dual send. Send the event to both Inngest and Hatchet, with the Go task still off, to prove delivery.
  3. Cutover. One pull request gives the Go task its trigger, deletes the Node function, and turns on the real effect (the email, the text, the payout).
  4. Hatchet only. When an event’s last Node consumer is gone, it stops going to Inngest.

The catch: deleting a Node function cancels its sleeping runs, so a reminder due next Tuesday would never go out. At first we waited days for runs to drain. Then we switched to backfill and cancel. A one-off Go task recreates every pending run from the database, each with a fixed ID so it can’t run twice, and then we delete the Node function.

Background jobs on Go and on Node

  • Go
  • Node
Share of our Inngest functions that had moved to Hatchet jobs in the Go worker, and the share still in the Node app, at the end of each day. Each day is measured against the most functions there had been so far, from the history of main.
Show the data
DayGoNode
Oct 300100
Oct 310100
Nov 10100
Nov 20100
Nov 30100
Nov 40100
Nov 50100
Nov 60100
Nov 70100
Nov 80100
Nov 92.797.3
Nov 107.492.6
Nov 1110.789.3
Nov 1269.830.2
Nov 131000

Most jobs moved in the last two days. At the end of November 11, 89% of our Inngest functions were still on Node. A day later 30% were, and by the end of November 13 none were.

Sign-in, moved last and slowest

A mistake in sign-in locks people out, so Better Auth went last and slowest. First Go signed a header telling Node who the user was, and both session checks ran side by side for a day with zero mismatches. Then Go answered each sign-in route (email codes, Google, one-tap, sign-out, staff support sign-in, and the OAuth server for MCP clients) with Node still mounted as a fallback. Then we removed Node.

Removing the server

With nothing calling Node, the app became a plain single-page app, and we deleted TanStack Start, Nitro, and the Node server. Migrations became plain SQL files, run at boot by a Go migrator under an advisory lock.

Budgets that kept Go fast

A correct port that’s slower is still a regression, so the build enforces budgets. Every Go test package and CI step has a time limit, and you don’t raise one to make a change pass. Every route declares how many Postgres round trips it may make, and a route over its limit fails at startup unless the code gives a reason.

Each flip compared the operation’s median and slow-tail latency with its Node baseline; the rule was that a Go route slower than Node is a bug. A speed review on every Go or CI change looks only for things that slow down tests, builds, or deploys, and a daily check flags any CI step whose slow runs reach 60% of its time limit.

Tests with timers use Go’s synctest, so a test can sleep for a week in microseconds, and tests use recorded vendor responses instead of live calls.

Watching each flip in production

Every flip came with a written watch. A typical one: for 48 hours, flag any 5xx on this operation, compare its call volume with the old version to catch a caller that stopped calling, and roll back by removing one name from the routing list.

That only works if a 5xx means a real problem. A scanner probing random paths, or an old browser tab calling a retired function, gets a 404 or a 410, so a 500 is worth someone’s attention.

The agents

Meeseeks, Harness, and Gatekeeper

The agents ran on Meeseeks, our internal platform for running software work with agents. We’ll write about it separately. In short: each agent lives in a Meeseeks box, a sandbox with its own checkout, a durable disk, and a session that survives the machine going to sleep. It runs on Harness, our open-source agent harness. A box sleeps when idle, wakes on a message, a GitHub event, or a schedule, and can message other boxes, so one coordinating box can hand work to many others.

Gatekeeper, also open source, sits between every box and the outside world. A box holds no secrets. When an agent calls Stripe, Hatchet, or GitHub, Gatekeeper adds the credential on the way out, so every agent worked against production services without seeing a key.

Every pull request got a correctness review and an excess review from agents, plus the speed review on Go and CI changes. The gate passes only for the exact commit reviewed, and the merge waits until every review thread has an answer.

The excess review flags code that does more than the change needs. Its cuts are mandatory unless the pull request lists the choice under Decisions with a reason. Agents will write a helper for everything; this is how we kept that out.

How the boxes worked together

Each long-lived box owned one area end to end: the appointment jobs, sign-in, the CI pipeline. A coordinating agent assigned work, answered small questions, and queued merges. A fresh builder box took each large change, so no session carried stale context into the next.

I made the product calls: which emails to cancel, how to handle an unusual payment, what to do when a policy was ambiguous. Money, customer messages, and policy came to me, and the agents drafted the note or Slack message for me to send. The rest was theirs to decide, with the reasoning written down.

Workers were told to report exceptions only: “PASS” with the exact commit, or a blocker with a specific question. A worker about to ask anything else was told to make the call, say why, and keep going.

A lot of it was housekeeping. Each task got its own git worktree and Postgres. Each box cleaned its build caches and finished worktrees on a schedule, because a full disk silently freezes an agent. Each box was renamed when its job changed, so the fleet list doubled as a status board.

There were two more rules. Flakes were supposed to get an owner and a fix the same day rather than a follow-up ticket; the causes were ordinary, like a test that depended on the time of day or a CI step running out of disk. And a code change had to fix the docs it made wrong in the same pull request, so there were no progress documents to drift.

Scheduled routines

The coordinator didn’t rely on remembering to check things. It ran routines on a schedule, each with a written prompt, a log line, and a rule for when to bring me in:

RoutineHow oftenWhat it did
Prod healthHourlyRead two hours of logs. Flagged Go operations with two or more server errors, recently deleted Node operations with even one, and merges that hadn’t passed the queue. Assigned a fix or revert, and told me.
PR stall checkEvery few hoursFound pull requests that passed review but weren’t queued, or that the queue dropped, and rebased, re-armed, or reassigned them.
Idle and drift checksEvery few hours, dailyGave stopped agents their next task, and asked whether each agent’s work moved an endpoint to Go.
Compare coverageEvery six hoursChecked that compare-mode operations were comparing real requests, and flagged any mismatch.
Process reviewEvery twelve hoursRan the scorecard below.
First-run checkOnce per cutoverConfirmed a moved job’s first natural run (Monday’s cron, Friday’s payout) did the right thing, and that the Node copy didn’t also run.
24- and 48-hour watchOnce per flipFollowed that change’s written watch.

The stall check exists because a pull request once sat dropped from the queue for three and a half hours. Decisions, merges, and findings also went into an append-only ledger, which is how an agent found its place again after a context reset.

Keeping work in scope

The first rule was that this was a migration and nothing else: no new functionality and no cleanup. Go did what Node did, and where it differed, the edge map said why.

A reviewer sees only the diff, so a long review loop can turn a bug fix into a feature. Every third round, the owner compared the remaining fixes with the pull request’s stated scope. Anything that wouldn’t have been in the original didn’t get pushed; the coordinator either grew the scope on purpose or froze the pull request and wrote a follow-up. From round four, a fail-safe edge case no real client sends became a written decision instead of another fix. Anything that failed open or touched security still got fixed. And a route called fewer than five times a week got at most three pull requests.

Working alongside the rest of the team

The rest of the company kept shipping during the migration, with their own agents. One-way ratchets in CI kept us from colliding: lint rules blocked new Node server functions and Hono imports, with allowlists that could only shrink.

Every coding agent in the company reads the same AGENTS.md files, which said new endpoints go in Go and how to add one. When a rule changed (Drizzle gone, migrations in plain SQL, Hono deleted), the instructions changed in the same pull request. While Node and Go versions of something both existed, a fix to one had to be a fix to both, and compare mode or the recorded fixtures flagged drift.

One gap: we had no way to tell a teammate directly that something they were editing had just moved. They found out from a failed CI run or a queue conflict. A branch that still used a deleted file failed in the merge queue and never reached main, so the cost was the occasional rebase.

Measuring it

A scorecard every twelve hours

Twice a day, a scheduled review scored the last twelve hours of GitHub and CI data against the twelve before. It used the DORA measures, throughput and lead time on one side and instability (change-fail rate, rework, minutes main was broken) on the other, plus two for agents: failed review rounds per pull request, and CI cost.

Speed counted only if instability didn’t rise. Each review named the metric that moved most in the wrong direction, found its cause in real pull requests, and shipped one fix. Some of what it caught:

WindowMergedWhat movedThe one fix
Nov 6–765A broken merge slipped past the queueEvery health check also checks the queue result of each recent merge
Nov 8–973Review failures per pull request roseWrite the edge map before the first push
Nov 10–1199Too many review rounds on edge casesFrom round four, a fail-safe edge case no real client sends is a listed decision
Nov 12140Throughput fell 42% from merge conflictsSplit the shared files every cutover edited into one file per job
Nov 12–1316158 failed merge-queue runsFix the CI steps near their time limits, and add the daily headroom watchdog
Nov 1382Passed pull requests dropped from the queue on conflictsFlag a conflicted pull request to its owner in the same step that arms it

The busiest twelve hours, starting mid-morning Eastern on November 11, merged 302 pull requests. The scorecard reported a change-fail rate of zero in every window but one.

By the numbers

From October 29 to November 13, main merged about 3,000 pull requests, ours and the rest of the team’s, with a peak of 396 in a day. That’s about five times as many per day as in the two weeks before. Most of the coordinator’s sub-agents were code reviewers, and workers ran their own reviewers too, two per round.

Pull requests merged to main per day

Every pull request merged to main each day, the migration’s and the rest of the team’s. November 13 is partial.
Show the data
DayPull requests
Oct 2995
Oct 30139
Oct 31277
Nov 1267
Nov 2212
Nov 366
Nov 465
Nov 5106
Nov 6118
Nov 7130
Nov 8269
Nov 9226
Nov 10145
Nov 11372
Nov 12396
Nov 13145

Every one went through a merge queue that tested it against everything ahead of it. At close to 400 a day, shared files that every cutover edited caused queue conflicts, which is why we split them into one file per job.

Paying for it

The agents ran on flat-rate Claude and Codex subscriptions, not per-use API billing. Builders ran on a fast mid-size model. Reviewers ran on another vendor’s model, so they wouldn’t share the builder’s blind spots. The coordinator ran on the largest model. The AI bill for the migration was the subscriptions we already paid for.

CI was the real cost. It runs on Blacksmith runners, and we tracked runner minutes per merged pull request like any other metric. We moved to fewer, larger pull requests, used cheaper runners where speed didn’t matter, balanced shards by measured duration, cached builds, and deleted jobs that only compared the two backends.

What I’d do again

  1. Put the new system in front on day one, doing nothing. A pass-through proxy is cheap, and it turns every later step into a config change you can roll back by name.
  2. Make each route earn its move. Write the edge map before the port, compare reads on real traffic, and turn recorded writes into fixtures that outlive the old code.
  3. Measure the process, not just the code. Read throughput and instability together, fix one thing per review, and watch CI minutes more closely than AI spend.

What’s next

Because the move changed nothing else, our API still has the shape it had on Node. With every endpoint now in one Go codebase, we can make larger changes to its design, and the replay fixtures from the migration will tell us when behavior changes.

Cite Bonventre, A. (2026). How we moved our entire backend from Node to Go in two weeks.