---
title: Native Languages in Next.js
description: Next.js 16.5 introduces experimental Go support with route.go, alongside the first phase of rewriting the next start server in Go.
url: "https://nextjs.org/blog/native-languages-in-nextjs"
docs_index: /docs/llms.txt
publishedAt: December 2nd 2026
authors:
  - Jamiboy Mohammad
  - Jan Kassens
  - Janka Uryga
  - Tim Neutkens
---



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 two new App Router conventions (`route.go` and `proxy.go`) alongside the first phase of **rewriting the `next start` server in Go**. */}

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](https://www.anthropic.com/research/migrating-api-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](/blog/next-16-3#faster-type-checking-with-typescript-7), and Rust-backed React Compiler improvements in [Next.js 16.4](/blog/next-16-4#rust-react-compiler). 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:

```go filename="app/api/hello/route.go"
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`](/docs/app/api-reference/file-conventions/route):

- **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).

<ComparisonChart
  title="Cumulative active CPU time across 200 requests (lower is better)"
  ariaLabel="Cumulative active CPU time across 200 requests for a production workload comparing route.ts on Node.js versus route.go. Lower is better."
  groups={[
    {
      label: "Cumulative active CPU time (200 requests)",
      improvement: "81% less",
      ariaLabel: "Cumulative active CPU time across 200 requests",
      wideLabels: true,
      bars: [
        {
          label: "route.ts",
          value: "23.412s",
          percentage: 100,
          ariaLabel: "route.ts on Node.js: 23.412 seconds",
        },
        {
          label: "route.go",
          value: "4.546s",
          percentage: 19.4,
          ariaLabel: "route.go: 4.546 seconds",
        },
      ],
    },
  ]}
/>

Read the [`route.go` API reference](/docs/app/api-reference/file-conventions/route-go) for full details and examples.

{/* ## `proxy.go`

Next.js 16.5 also adds experimental `proxy.go` for running Go code before a request is routed. Place `proxy.go` next to `app/` (or inside `src/`) and import the bundled `next/go/proxy` SDK:

```go filename="proxy.go"
package proxy

import (
  "net/http"
  "next/go/proxy"
)

var Config = proxy.Config{
  Matcher: []proxy.Matcher{
    {Source: "/account/:path*"},
    {
      Source: "/special",
      Has:    []proxy.Condition{{Type: "header", Key: "x-special"}},
    },
  },
}

func Proxy(w http.ResponseWriter, r *http.Request) {
  if r.URL.Path == "/account/legacy" {
    proxy.Rewrite(w, "/account/v2")
    return
  }

  headers := r.Header.Clone()
  headers.Set("Host", r.Host)
  headers.Set("x-proxy", "go")
  proxy.Next(w, proxy.WithRequestHeaders(headers))
}
```

Use `proxy.Next` to continue routing, `proxy.Rewrite` to rewrite to another path, and `proxy.WithRequestHeaders` to modify downstream request headers. Standard `net/http` calls handle redirects, cookies, and direct responses; cookies set with `http.SetCookie` are available through [`cookies()`](/docs/app/api-reference/functions/cookies) in downstream routes and pages.

The `next/go` module ships inside the `next` package. When your project has a `go.mod`, `next dev` and `next build` automatically add the `next/go` requirement and local directory replacement, keeping editors, linters, and coding agents in sync with your installed Next.js version without external downloads.

Read the [`proxy.go` API reference](/docs/app/api-reference/file-conventions/proxy-go) for matcher semantics and behavior details. */}

## 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` and `proxy.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:

```bash filename="Terminal"
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%**.

<ComparisonChart
  title="Direct `route.go` invocation in `next start` (higher is better)"
  ariaLabel="Requests per second for a route.go endpoint routed through Node.js versus directly invoked by the Go-based next start server. Higher is better."
  groups={[
    {
      label: "Throughput (req/s)",
      improvement: "4.3× higher",
      ariaLabel: "route.go requests per second",
      wideLabels: true,
      bars: [
        {
          label: "Via Node.js",
          value: "5,956 req/s",
          percentage: 23.1,
          ariaLabel: "Routed through Node.js: 5,956 requests per second",
        },
        {
          label: "Direct Go",
          value: "25,818 req/s",
          percentage: 100,
          ariaLabel: "Directly invoked by the Go-based next start server: 25,818 requests per second",
        },
      ],
    },
  ]}
/>

{/* Directly invoking `route.go` and `proxy.go` is the first phase. */}

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`, `proxy.go`, and the Go-based `next start` server work with `next start` and [`output: 'standalone'`](/docs/app/api-reference/config/next-config-js/output). */}
{/* - **Adapters API**: Following the stable [Adapter API](/blog/nextjs-across-platforms) 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` and `proxy.go` natively. The exact Adapter API for native runtimes hasn't been decided yet and will be finalized before `route.go` and `proxy.go` move to stable. */}

- **Self-hosting**: `route.go` and the Go-based `next start` server work with `next start` and [`output: 'standalone'`](/docs/app/api-reference/config/next-config-js/output). 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](/blog/nextjs-across-platforms) 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`:

```ts filename="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`.

{/* To use `proxy.go`, also initialize a Go module (`go mod init example.com/app`) and add `proxy.go` next to `app/` (or inside `src/`). */}

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.

{/* - `proxy.go` supports App Router applications only and cannot be combined with `proxy.ts`. */}

## What comes next

{/* `route.go`, `proxy.go`, and the initial Go-based `next start` server are the first step toward native language support in Next.js. */}

`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](https://github.com/vercel/next.js/discussions) or report bugs on [GitHub Issues](https://github.com/vercel/next.js/issues).
