Skip to content

Next.js API routes can now be written in Go. How is route.go different from route.ts?

route.go is about 3 times faster. route.ts wins on deploy, caching and stability. Here is the comparison, with numbers.

Bassically · Tech Reviews, part 1. I measured this on my own machine. The code is in the repo.

Short answer: route.go wins on speed, route.ts wins on everything else. For now, stay on route.ts.

What I tried

Next.js canary has a new feature: an API route can be written as route.go (Next.js docs). It was merged on 3 November 2026 and is still experimental.

I wrote three routes, each one twice: once as route.ts, once as route.go. Then I compared four things.

Difference 1: who runs your code

Take one request, GET /api/hello. It goes through four steps:

  1. Take the request from the browser.
  2. Find the route that matches /api/hello.
  3. Run the GET function you wrote.
  4. Send the answer back.

With route.ts, Node does all four.

With route.go, Node still does steps 1, 2 and 4. It hands step 3 to a Go program, because Node cannot read Go code.

So each Go route is one more program running next to Node. After I called three Go routes, the machine was running four processes: Node, plus one per Go route (9, 12 and 19 MB).

Difference 2: speed

route.go answered about 3 times more requests for a small JSON: 9,927 per second against 3,034.

For heavy math the gap is at least 7 times (7 to 13 across five runs). Part of that is Go using every core while Node runs on one thread. Even on one core, Go is still 2 times faster.

Difference 3: deploy

route.ts runs every way Next.js can be deployed.

route.go today only runs with next start, on a machine with the same operating system as the build machine. standalone output, the one usually used for Docker, is not supported.

Check it yourself: Deployment and Build and Runtime Limitations in the docs.

Difference 4: features

  • Caching. route.ts can be cached. route.go always runs again (Segment Config Options).
  • First request. route.ts takes about 12 ms. route.go took 0.3 to 0.9 seconds on the first start after a build, because its program only starts when the first request arrives. On later restarts it took 13 to 35 ms.
  • Status. route.ts is stable. route.go is experimental and can still change, and its page is only in the preview docs so far.

Conclusion

route.tsroute.go
Small JSON3,034 requests/s9,927 requests/s
Heavy math178 requests/s1,332 requests/s
First request after a build12 ms0.3–0.9 s
Your code runs inNodea Go program, one per route
Deployevery waynext start only
Can be cachedyesno
Statusstableexperimental

Which one to use?

  • Almost every route: route.ts.
  • One heavy route: route.go, but later, once the feature is stable.

How it was measured

50 connections for 15 seconds per route, next start, one laptop (Apple silicon, 10 cores), one run. So read the gaps, not the last digit. The deploy and caching limits come from the documentation; I did not test them myself.

Code

Every route, the scripts and the raw results: github.com/haryarrahman14/tech-reviews, folder 01-nextjs-go-routes.

Sources

Follow