Skip to content
nextrs-shPublic

About

NextRS — A high-performance Rust runtime for Next.js. Build with Next.js. Run with Rust.

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

NextRS: Build with Next.js. Run with Rust.

An experimental Rust-powered production runtime for Next.js.
It serves the output of an official next build from a Rust HTTP server, and runs the compiled server code in embedded V8.

Status: experimental npm: @nextrs/cli, dist-tag next Tested with Next.js 16.4.6 License: MIT or Apache-2.0

Why NextRS? · Quick start · Compatibility · Docs · Releases · Roadmap


You develop and build your application with Next.js, exactly as today. Where you would run next start, you run nextrs start. Static files and prerendered pages are answered by Rust. Dynamic routes run Next.js's own compiled handlers inside embedded V8, so no separate Node.js server process serves the application.

NextRS is a research project. It explores whether Next.js production serving can become more predictable and efficient by giving the HTTP layer, caching and resource limits to Rust, while staying compatible with the framework's own build output.

Warning

Experimental. NextRS is tested with Next.js 16.4.x on Linux x86_64 and has not run in production. It does not support every Next.js feature or every Node.js package. Do not expose it to untrusted traffic before reading the security notice.

What is NextRS?

A Next.js application reaches production in two steps: next build compiles it, and a server, normally next start, answers requests with that output. NextRS is an alternative for the second step only.

Next.js today With NextRS
Your code Next.js and React Unchanged
Develop next dev next dev
Build next build (Node.js) next build (Node.js)
Serve in production next start (Node.js) nextrs start (Rust + embedded V8)
Your backends APIs, databases, auth Unchanged, separate processes

It is written in Rust, with axum and Tokio for HTTP, and embeds the V8 JavaScript engine (through deno_core) to run the parts of Next.js that must execute JavaScript. It reads the same .next directory next start reads, and treats next start as the reference: a response counts as compatible only when it matches what the official server returns for the same build.

Why NextRS?

Node.js is a mature, reliable runtime and remains the standard choice for Next.js. NextRS is not an attempt to replace Node.js. It asks a narrower question: can a purpose-built production runtime serve Next.js applications more efficiently while preserving the framework's behavior?

A production server does more than execute JavaScript. It handles HTTP, serves static assets, manages caches, compresses responses and manages system resources. Many of these responsibilities do not inherently require JavaScript execution. NextRS handles supported serving paths in Rust and uses embedded V8 for the Next.js handlers that need JavaScript.

What we are working toward:

  • Lower memory consumption. Reduce runtime overhead and make memory use more predictable, especially in resource-constrained containers.
  • Better CPU efficiency. Reduce unnecessary JavaScript work and request-processing overhead.
  • Predictable performance. Improve latency consistency and throughput under concurrent workloads.
  • Lower infrastructure costs. Explore whether applications can meet the same service requirements with smaller resource budgets.
  • Next.js compatibility. Keep next dev and next build, with no application rewrite for supported features, and use next start as the behavioral reference.
  • Operational simplicity. Provide explicit controls for concurrency, queues, deadlines, memory, caches and outbound network access, with supervised V8 isolates. See configuration.

These are engineering goals, not guarantees. NextRS is experimental, and some workloads are slower or use more resources than next start. Compatibility and efficiency must be demonstrated through comparison tests and reproducible benchmarks.

The goal is not to rewrite Next.js in Rust, but to use Rust where it makes sense and JavaScript where it is needed.

Quick start

Requirements: Linux x86_64 with glibc 2.35 or later (Ubuntu 22.04+, Debian 12+), a Next.js 16.4.x application, and Node.js for next build. The npm package carries a precompiled binary: running NextRS needs no Rust, Cargo or Node.js.

In your Next.js application:

# 1. Install the current release candidate (prereleases use exact versions)
npm install --save-dev @nextrs/cli@0.1.0-rc.3

# 2. Build with Next.js, as usual
npx next build

# 3. See how NextRS will serve each route, and anything it does not support
npx nextrs inspect .

# 4. Serve the build; dynamic routes need the embedded V8 runtime
npx nextrs start . --js-runtime embedded-v8

NextRS listens on http://127.0.0.1:3000 by default (--port, --host).

  • nextrs doctor . is a read-only check of your project, build and planned options: what to change before you serve it. See Doctor.
  • pnpm works the same way: pnpm add -D @nextrs/cli@<version>, then pnpm exec nextrs ….
  • In production, start ./node_modules/.bin/nextrs directly, not through npx or npm start, so that SIGTERM reaches the server.
  • Standalone binary, Docker and pnpm details: see the installation guide, which also covers building from source. Every option is in nextrs start --help and the configuration reference.

How it works

Architecture: a Next.js app (App Router, Pages Router) is compiled by next build into the .next output. The NextRS runtime, one Rust process, reads it. Its HTTP server applies routing and next.config rules. Static files, prerendered HTML and RSC, and image optimization are served from Rust. Dynamic SSR, Route Handlers, Server Actions and proxy.ts run Next.js's compiled handlers in embedded V8, which use a shared cache held in Rust. Your backends (APIs, databases, auth) stay separate processes, reached with fetch only where --net-allow permits.

  1. Build with Next.js. next build produces .next as usual. Node.js is needed here, and only here.
  2. Rust answers what needs no JavaScript. Static assets, public/ files, prerendered HTML and RSC payloads, next.config routing rules and /_next/image are served directly from Rust.
  3. V8 runs what does. Dynamic rendering, Route Handlers, Server Actions, ISR regeneration and proxy.ts run Next.js's compiled handlers in a pool of V8 isolates (--js-runtime embedded-v8). Their cache entries live in one Rust store shared by every isolate.
  4. Your backends stay where they are. Server code reaches them with fetch, which is denied unless --net-allow names the destination.

A V8 isolate is a memory boundary, not a security sandbox, and CPU limits apply per isolate, not per request. The architecture reference covers the request lifecycle in depth.

Features

Statuses follow the compatibility matrix. Experimental means it passes the comparison suites against next start on the test applications, with the gaps the matrix lists.

Area What NextRS does Status
Static serving /_next/static, public/, prerendered HTML, RSC payloads and the not-found page, with Next.js's caching headers Supported
Build inspection nextrs inspect reports how each route is served; unsupported features are refused at startup rather than served wrongly Supported
App Router rendering Dynamic SSR with streaming, React Server Components, Route Handlers, generateStaticParams, Draft Mode Experimental
Server Actions Forms, client calls, uploads, redirects and cookies, through Next.js's own handlers Experimental
Caching and ISR The Next.js data cache, ISR and on-demand revalidation in one cache shared by every isolate, optionally persisted (--cache-dir) Experimental
Cache Components "use cache" (also private and remote), cacheLife, cacheTag, Partial Prerendering shells, custom cache handlers (CommonJS) Experimental
Pages Router getServerSideProps, getStaticProps with ISR, API routes, Preview Mode, /_next/data, Next.js i18n routing Experimental
Proxy and routing proxy.ts / middleware on the Node.js runtime; next.config headers, redirects and rewrites in next start's order; basePath, trailingSlash Experimental
Images /_next/image in Rust, without sharp, within a memory budget Experimental
HTTP gzip compression with a cache, byte ranges, conditional requests, deploymentId Experimental
Operations Multi-isolate pool with supervision, outbound network policy, health and readiness probes, Prometheus metrics, JSON logs Experimental
Memory and resources Container-sized V8 heaps, memory reclamation and the balanced and low-memory profiles (opt-in); memory-aware admission, buffer budgets and file-backed prerendering (off by default) Opt-in; experimental
Diagnostics nextrs doctor: read-only checks of the project, build, Node.js API use and runtime options Experimental

Not supported: the edge runtime and WebSockets through external rewrites. Node.js support is a narrow layer: http, net, TCP sockets, child_process, worker_threads and native addons are unavailable, so many database drivers do not work in server code. The known gaps list every difference from next start.

Performance

NextRS is benchmarked against next start on the same Next.js build. The chart shows one workload, dynamic App Router SSR (/books/[id]), measured on November 18, 2026.

NextRS vs next start, Dynamic App Router SSR (/books/[id]), measured November 18, 2026 on NextRS f5c480d, Next.js 16.4.6 and Node.js 24.18.0, same Next.js build, median of 3 interleaved rounds. NextRS with one isolate against next start: throughput 20% higher (736 against 611 req/s); p95 latency 47% lower (3.30 against 6.26 ms); anonymous memory 63% less (141 against 376 MiB); CPU time per request 9% less (1.75 against 1.92 ms). Scale across V8 isolates: NextRS with 4 isolates reached 1,898 req/s, 3.11 times next start, sharing the same four-CPU server allocation; the Node baseline is one server process.

What it shows. With one isolate (one JavaScript thread, as next start has), NextRS served this route at 736 req/s against 611, with a p95 of 3.30 ms against 6.26 ms, 141 MiB of anonymous memory against 376 MiB, and 1.75 ms of CPU per request against 1.92 ms. Four isolates reached 1,898 req/s on the same four CPUs; that is extra parallel JavaScript, not an equal-worker comparison, and it used more memory (509 MiB).

What it does not show. The results come from one Intel Core i5-9400F, a pre-release build (f5c480d) and requests without compression. In the wider 24-workload matrix, NextRS is not ahead everywhere: at its default two image workers it transforms fewer images per second than next start (more with four), one Pages Router route has a higher p95 at low load, and four isolates scale 2.1–3.6×, not 4×. Measure your own application before drawing conclusions. Results, environment and raw data → · Methodology →

Project status

Stage Experimental, developed in the open. Not production-ready; binds to 127.0.0.1 by default.
Published release v0.1.0-rc.3, a prerelease, on GitHub Releases and on npm as @nextrs/cli (dist-tag next).
Platform Linux x86_64, glibc 2.35+. macOS, Windows, arm64 and musl are refused.
Next.js 16.4.6 (CI baseline) and 16.4.5, React 19.3.1. Other 16.x start with a warning; other majors are refused.
Tested on Test applications compared response by response with next start, independent sample applications, and the unchanged Velasia Airways storefront: 101 of 111 browser tests passed at 1 and 4 isolates on November 18, 2026, with 10 mobile-only tests skipped by design (results).
Not yet done Production use, cloud certification, per-request CPU limits, a validated memory envelope for small containers. See known gaps and security.

Roadmap

NextRS is under active development. The roadmap focuses on expanding Next.js compatibility, improving developer experience, optimizing runtime performance, and making production behavior increasingly reliable. These are directions, not commitments: there are no dates, and priorities follow what the comparison suites and measurements show.

Theme Direction
Developer experience nextrs doctor is available and will keep growing. Planned: nextrs dev, a development workflow built around the official Next.js tooling; nextrs preview, to run and check a production build locally; clearer CLI errors, simpler configuration, more examples.
Next.js compatibility Broader App Router and Pages Router coverage, more Node.js APIs and third-party packages, authentication and database integrations, an investigation of the edge runtime, and new Next.js versions as they ship. Full compatibility is the aim, not a promise.
Performance and efficiency Throughput, latency, CPU and memory under load; isolate scheduling and multi-core use; startup time; static and image serving; allocation and memory retention, including bounding concurrent compression-cache fills, which current measurements motivate.
Reliability and security Per-request execution limits, predictable resource bounds and memory use in small containers, cache correctness, request isolation, graceful shutdown and recovery, network and dependency security, observability.
Testing and certification More and larger real-world applications, regression testing against next start, browser end-to-end runs, load, soak and fault-injection tests, cloud deployment validation, and performance regression tracking.
Deployment and platforms Docker and deployment recipes, CI/CD integration, cloud platform guides, broader Linux coverage, and other operating systems and architectures where feasible.

The roadmap describes each direction in more detail.

Documentation

I want to… Read
Try it on my app Getting started · Installation · CLI · Doctor
Know whether my app will work Compatibility
Tune limits, caching, networking and images Configuration
Deploy and operate it Deployment · Security · Troubleshooting · Release guide
Understand the design Architecture · Distribution
Check the numbers Performance · Benchmarks and methodology
Contribute Contributing guide · Development · Testing
See everything Documentation index · Changelog

Contributing

Contributions are welcome, and some of the most useful ones need no Rust:

  • Try NextRS on your application and open an issue with what worked and what did not. Include the output of nextrs inspect and nextrs doctor --json.
  • Report a compatibility difference from next start, ideally with a small reproduction.
  • Improve the documentation where it confused you.

The code is five Rust crates under crates/: the build reader, the HTTP server, the V8 runtime, the image engine and the CLI (repository structure). For code changes, please open an issue before starting anything large. Every change must pass cargo fmt, clippy -D warnings and the tests; changes to serving behavior should also pass the comparison suites against next start. The contributing guide covers setup, the checks and the workflow. Report security issues privately, as SECURITY.md describes.

License

Licensed under either of MIT or Apache-2.0, at your option. Release archives and the npm package also carry the license and notice texts of every bundled third-party component (THIRD-PARTY-LICENSES.txt), including V8 and the Deno JavaScript compiled into the binary.

NextRS is an independent project. It is not affiliated with, endorsed by or supported by Vercel or the Next.js team. "Next.js" is a trademark of Vercel, Inc.

About

NextRS — A high-performance Rust runtime for Next.js. Build with Next.js. Run with Rust.

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages