正在把原文翻译成中文,长文需要一两分钟;先显示原文。

2 Dec 2026

Blog

Tim Neutkens, Jamiboy Mohammad, Janka Uryga, Jan Kassens

For the past decade, Next.js has been built around a clear and deliberate philosophy: one language, one runtime. Your UI, your server rendering, your API routes, and your proxy logic have all lived in TypeScript and JavaScript on Node.js.

In Next.js 16.5, we're beginning a major shift in that philosophy.

We're introducing experimental support for native languages in Next.js, starting with Go through a new App Router convention (route.go) alongside the first phase of rewriting the next start server in Go.

React, TypeScript, and Node.js remain the core of Next.js. Now, when a backend workload benefits from a compiled native language, you can write it inside the same Next.js application without rebuilding your infrastructure or managing separate services and deployments.

Why add native languages now?

For years, keeping an entire full-stack application in TypeScript was the right tradeoff for most teams. Even when a specific workload (such as a high-throughput webhook receiver, a streaming proxy, or a CPU-heavy data pipeline) would have been faster or cheaper in a native language, adopting a second language meant taking on substantial overhead:

  • Creating and maintaining a second service
  • Configuring a separate build pipeline, router, and deployment topology
  • Requiring every engineer on the team to context-switch across languages and toolchains

The rise of agentic coding has changed that equation.

On Vercel, deployments driven by coding agents grew from 3% at the start of 2026 to 60% by November. It took ten years for Vercel to reach its first billion deployments, and only ten months for the next 1.5 billion.

We're already seeing what happens across the industry when coding agents remove the language-switching tax. Anthropic recently shared how they used Claude to migrate a high-throughput Python API path to Rust as traffic scaled, cutting CPU usage per request by roughly 70% and median time-to-first-token by roughly 20%.

Coding agents make it straightforward to write, test, and maintain idiomatic Go alongside TypeScript, leaving infrastructure as the main friction point. Teams should be able to pick the right language for a specific backend route without tearing apart their application architecture or running separate deployments.

This also follows the natural arc of Next.js 16. We've steadily moved build-time and developer tooling to native code, including Turbopack in Rust, TypeScript 7's Go-based typechecking in Next.js 16.3, and Rust-backed React Compiler improvements in Next.js 16.4. Next.js 16.5 brings that same principle to your application's runtime and production server.

Why Go first

Go fits the constraints of both development and production in Next.js:

  • Incremental build speed: Go compiles quickly enough to preserve next dev iteration loops.
  • Standard library HTTP: net/http is stable, widely understood by developers and coding agents, and requires no separate web framework.
  • Statically linked binaries: Go compiles all routes into a single, self-contained executable with no runtime dependencies, which maps cleanly onto next start and output: 'standalone'. Go's built-in cross-compilation also gives us a straightforward path to targeting different deployment architectures in future releases.
  • Runtime characteristics: Go's networking stack and low memory footprint suit both application routes and the production server itself.

route.go

With experimental.goRoutes enabled, you can add a route.go file anywhere in app/ using Go's standard net/http package:

package route

import (
  "encoding/json"
  "net/http"
)

func GET(w http.ResponseWriter, r *http.Request) {
  w.Header().Set("Content-Type", "application/json")
  json.NewEncoder(w).Encode(map[string]string{"message": "Hello from Go!"})
}

route.go follows the same file-system and HTTP method conventions as route.ts:

  • HTTP methods: Declare top-level GET, POST, PUT, PATCH, DELETE, HEAD, or OPTIONS functions taking (w http.ResponseWriter, r *http.Request). HEAD falls back to GET, OPTIONS generates an Allow header automatically, and unmatched methods return 405.
  • Dynamic routes and streaming: Read dynamic segments with r.PathValue("id") or the generated ParamValues(r, "slug") helper for catch-all segments. Stream responses using http.Flusher and detect client disconnects with r.Context().Done().
  • Standard Go packages: Each route directory compiles as an ordinary Go package. Sibling .go files, local and internal module imports, and go:embed work as expected.
  • Static segment configuration: Declare const MaxDuration = 30 in route.go. Turbopack parses it statically without executing application code.

In next dev, Turbopack tracks route.go, sibling files, local packages, module metadata, and embedded assets, recompiling only the modified route on change. In next build, Next.js compiles every route.go directory into a single shared Go executable, so production runs one compiled process for all Go routes without requiring the Go compiler at runtime.

In a benchmark of a production workload measured across 200 requests, cumulative active CPU time dropped from 23.412s with route.ts to 4.546s with route.go (81% less CPU time, over 5× lower).

Cumulative active CPU time (200 requests), 81% less

route.ts23.412s

route.go4.546s

Cumulative active CPU time across 200 requests (lower is better)

Read the route.go API reference for full details and examples.

Rewriting next start in Go

Running native routes behind a Node.js HTTP server leaves Node.js on the critical path for every request. As part of this work, we're rewriting the next start server in Go.

The initial focus of the Go-based next start server is directly invoking route.go. It owns the public port, receives the application's route table, and sends matching Go requests directly to Go without passing through Node.js, while forwarding React rendering and TypeScript/JavaScript routes to Node.js.

To try the Go-based next start server, pass the --experimental-new-server flag when starting your production server:

next start --experimental-new-server

In early benchmarks of a route.go endpoint, invoking Go directly from the Go-based next start server instead of forwarding through Node.js increased throughput from 5,956 to 25,818 requests/sec (4.3× higher), reduced p99 latency by 59%, and cut CPU per request by 37%.

Throughput (req/s), 4.3× higher

Via Node.js5,956 req/s

Direct Go25,818 req/s

Direct route.go invocation in next start (higher is better)

Directly invoking route.go is the first phase. Requests that Node.js still serves (route.ts handlers, dynamic pages, and public/ assets) currently pass through an extra proxy hop.

We're focusing on correctness first, preserving full parity with existing next start behavior, before moving on to further performance work. Our goal is to rewrite next start completely in Go, taking over routing, static asset serving, ISR, and caching, so self-hosted Next.js applications benefit from lower server overhead even when they don't use Go routes.

Self-hosting and the Adapters API

Native language support is built around open-source Next.js and portable deployments:

  • Self-hosting: route.go and the Go-based next start server work with next start and output: 'standalone'. Standalone builds copy the compiled Go executable with its permissions preserved, so production environments don't need the Go toolchain installed.
  • Adapters API: Following the stable Adapter API introduced in Next.js 16.2, we're designing native runtime support directly into the adapter contract so any hosting provider can run route.go natively. The exact Adapter API for native runtimes hasn't been decided yet and will be finalized before route.go moves to stable.

Getting started

Enable experimental.goRoutes in next.config.ts:

import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  experimental: {
    goRoutes: true,
  },
};

export default nextConfig;

Install Go 1.24 or newer on your PATH, then add app/api/hello/route.go.

Current experimental requirements and limitations:

  • Requires Turbopack (Webpack is unsupported).
  • Go routes always execute dynamically and don't support ISR, generateStaticParams, or output: 'export'.
  • React rendering, Server Actions, and TypeScript/JavaScript routes continue to run on Node.js.
  • Builds compile with CGO disabled for the build host's OS and architecture.

What comes next

route.go and the initial Go-based next start server are the first step toward native language support in Next.js. Over time, we plan to deepen native integration in the framework and expand beyond Go to additional native languages such as Rust. In parallel, we'll continue rewriting next start in Go and finalize the native runtime contract for the Adapters API.

Share feedback on GitHub Discussions or report bugs on GitHub Issues.