Next.js 16.5 Takes Its First Steps with Go in API Routes and the Production Server
- Published
- Views
- 6
- Comments
- 0
- Words
- 506
This post was translated from Chinese by AI. If anything reads oddly, the Chinese original is authoritative. 中文原文
Starting with Next.js 16.5, Go can handle requests in production. Developers can write APIs with route.go in the App Router, and the Next.js team has rolled out the first phase of a Go-based next start. Both features are experimental and can be tested independently.
Writing APIs in Go with the App Router
With experimental.goRoutes enabled, app/api/health/route.go can handle GET /api/health. The handler uses net/http from the Go standard library directly:
package route
import "net/http"
func GET(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNoContent)
}
Existing route.ts files can stay in other route directories. A production build compiles the project's Go routes into a single executable, so there’s no need to deploy a separate service for each Go endpoint. Local development and builds require Turbopack and Go 1.24 or later. When self-hosting the build output with next start or output: 'standalone', the production machine doesn’t need the Go toolchain.
The Go-based next start handles Go routes first
After building, you can try the Go-based production server with next start --experimental-new-server. With it enabled, the Go process listens on the public port and handles requests that match a route.go directly, without going through Node.js first. Node.js still handles dynamic page rendering, Server Actions, and existing JS/TS routes. It also continues to serve files in public/ for now.
The Next.js team compared the two request paths using a single Go route: throughput was 5,956 requests per second when Node.js forwarded requests and 25,818 requests per second when Go handled them directly. That measures the throughput gain from removing the forwarding step for this endpoint. It doesn’t mean the whole site or React rendering is 4.3 times faster.
route.go currently supports only dynamic execution and can’t be used with a fully static export via output: 'export'. For projects that already export Next.js to static files and serve them with a standalone Go service, this is a different deployment model: Go routes are built and run alongside Next.js, and the frontend can still use Next.js dynamic rendering.
Turbopack: cold compilation drops from 183 seconds to 44 seconds
The Next.js team benchmarked Vercel’s site on a machine with 30 cores and 60 GB of RAM, comparing 16.4.6 and 16.5.0. Turbopack’s cold-cache compile time dropped from 183 seconds to 44 seconds, and warm-cache compile time fell from 12 seconds to 4.4 seconds. Peak memory during cold compilation dropped from 24.1 GB to 15.0 GB, a reduction of about 38%.

The chart shows only the compilation phase. In the same benchmark, the full cold-cache production build went from 325 seconds to 159 seconds, and the warm-cache build went from 134 seconds to 107 seconds. These are Turbopack build results, from a separate test than the Go route throughput benchmark above.
Sources: Next.js 16.5 release notes · Native Languages in Next.js · Official Next.js benchmark chart
Comments 0