Repository navigation
Releases
NextRS v0.1.0-rc.3
NextRS v0.1.0-rc.3
Prerelease. The third release candidate of NextRS v0.1.0. It is
experimental software.
NextRS serves the output of an official Next.js next build from a single
Rust binary with embedded V8. It replaces next start, not next build.
Overview
rc.3 adds a diagnostics command and memory settings for containers, and
lowers idle CPU use:
nextrs doctor, a new command: it checks, without running anything,
whether a Next.js application and its production build suit NextRS, and
says what to change.- Memory settings for containers (opt-in): a V8 heap budget sized from
the container's memory limit, memory reclamation after load and under
pressure, and two presets,--profile balancedand
--profile low-memory. - Experimental resource controls (off by default and in every
profile): memory-aware request admission, an ArrayBuffer budget, a
native buffer budget, and file-backed prerendered output. - Less idle CPU and fewer copies: an event-driven isolate heartbeat
replaces a 25 ms timer, and the multipart, cache and prerender paths
copy less. - Preconditions on static files:
If-MatchandIf-Unmodified-Since
are evaluated for/_next/staticandpublic/files; a failed one is a
412. - A fix for
performance.timeOrigin, which could make a
revalidateTaginvisible for a while on one of several isolates.
No default changed. Without the new options, nextrs start serves as
rc.2 did, apart from the 412 above and the fix. nextrs start --help
lists the new options; nextrs inspect is unchanged.
Scope
| Platform | Linux x86_64, glibc 2.35 or later (unchanged) |
| Next.js | 16.4.6 (primary) and 16.4.5, React 19.3.1 (unchanged) |
| Other Next.js 16.x | Starts with a warning (untested) |
| Other Next.js majors | Refused at startup |
| JavaScript engine | Embedded V8; isolates configurable (--isolates) |
What's new: nextrs doctor
npx nextrs doctor # the current directory
npx nextrs doctor . # a project directory (or its .next directory)
npx nextrs doctor . --json # one JSON document on stdout, for CI
npx nextrs doctor . --strict # warnings fail tooRun next build first. Doctor reads files only. It never runs
next build, JavaScript or a server, creates no file or directory, binds
no socket and makes no network request. Node.js is not needed to run it.
What it checks
| Section | Checks |
|---|---|
| Environment | Platform, C library and glibc version, whether the path is a Next.js project, the installed Next.js against the version policy |
| Build | .next present and readable, the build's Next.js version (tested, untested, unsupported, security advisories), installed versus build version, node_modules/next when JavaScript runs, nextrs start's own startup checks, stale adapter output, missing .next/static |
| Compatibility | App and Pages Router, dynamic SSR, Route Handlers, generateStaticParams, Server Actions, ISR, Cache Components and Partial Prerendering, custom cache handlers, proxy and edge middleware, next.config rules, image optimization, edge-runtime routes, interception routes, i18n, instrumentation.ts |
| Node.js APIs | Native addons, TCP clients (database, cache, mail and queue drivers) and process-spawning packages in Next's file traces of each server entry |
| Runtime configuration | The options you plan to pass to nextrs start, parsed with start's own code: --js-runtime, the outbound network allowlist (external rewrites, remote images, fetch), the data and image cache directories, forwarded headers, .env files NextRS does not load, --js-env names, NEXT_DEPLOYMENT_ID, the Server Actions key and body limit |
Doctor reuses what nextrs start runs (the adapter's inspection, the
version policy, the startup checks, the flag parsers), so the two do not
disagree. Features are classified with the statuses of the capability
matrix: supported, experimental, partial, unsupported, and
unknown for what no suite covers. Experimental means it works on the
fixtures, not that it is verified for your application.
Output and exit codes
- Text on a terminal, with colors off for pipes,
NO_COLORand
TERM=dumb.--jsonprints one deterministic document (schema
version 1): no timestamps, findings in a fixed order, machine paths
replaced by.,<workspace>and~. - Every finding has a stable code (
NEXTRS-DOC-...), a severity (error,
warning,unknown,info,pass), a suggestion where there is one,
and a documentation link. - Exit codes:
0no confirmed blockers;1confirmed blockers (with
--strict, warnings too;unknownnever fails);2invalid arguments,
or the check could not run.
Exit code 0 does not mean the application works under NextRS. It means
Doctor found nothing known not to work. Test the build with nextrs start
and compare its responses with next start.
Untrusted projects
Doctor may be pointed at someone else's checkout, .next included:
- environment variable values are never reported: variables appear by
name, and.envfiles are read only for their names; - build metadata linked from outside
.next(aBUILD_IDthat is a
symlink to a credentials file, say) is not read; the assessment is then
reported as incomplete (NEXTRS-DOC-108); - Doctor's own reads are limited to regular files inside the project, its
.nextand its monorepo root, with size limits; nextrs start's startup checks run only when every stored response is a
regular file inside.next, within a memory budget, andpublic/has
no linked directories; otherwise they are reported as not run;- control characters from the project are escaped in text output.
Reference: docs/cli/doctor.md in the repository.
Preconditions on static files
If-Match and If-Unmodified-Since were not evaluated for static files in
rc.2. They now are, as RFC 9110 specifies, for GET and HEAD:
- evaluated before
If-None-Match,If-Modified-SinceandRange: a
failed precondition is never a304or a206; - a failure is a
412 Precondition Failed(plain text, no
Cache-Control).next startanswers it with its500error page; If-Matchuses the strong comparison. Static files have weak ETags
(W/"<size>-<mtime>", as withnext start), so a listed entity tag never
satisfies it, and onlyIf-Match: *does.next start(and rc.2, which
ignored the header) answer such a request with the file;If-Unmodified-Sinceaccepts HTTP-dates only; other date formats are
ignored.
Pages, route handlers and /_next/image are unchanged: as with
next start, their revalidation ignores both headers. Browsers do not send
these headers when loading pages and assets.
Memory settings for containers
By default V8 sizes each isolate's heap from the machine's memory, not the
container's. In a small container the heap can grow past what the
container allows, and the kernel kills the process before V8 collects
garbage harder. rc.3 adds settings for that case, all off unless given:
| Option | Effect |
|---|---|
--js-heap-limit auto |
Divides the container's memory limit (cgroup v1 or v2), less a native reserve, among the isolates' heaps |
--memory-reclaim-idle SECONDS |
After this long without traffic, each isolate runs a full collection and the native allocator returns its free memory |
--memory-pressure-reclaim PERCENT |
The same under load, when the container's working set reaches this share of its limit (at most every 10 s) |
--malloc-arena-max N |
Caps glibc's malloc arenas; measure before using it |
--profile balanced |
--js-heap-limit auto, idle reclamation after 30 s, pressure reclamation at 90 % |
--profile low-memory |
The same at 10 s and 85 %, and an 8 MiB compression cache |
Explicit flags win over a profile. None of these is a memory limit. A
V8 heap limit bounds one isolate's JavaScript heap, not the process: an
isolate that reaches it is replaced, and one very large allocation can
still end the process. The kernel enforces the container's limit.
Details: docs/configuration.md (Memory).
Experimental resource controls
These are off by default and in every profile. CI runs the comparison
suites against next start with the first four on, but they have not yet
been measured in small containers under sustained load. Try them in
testing, not in production:
| Option | What it bounds |
|---|---|
--memory-admission (and --memory-admission-*) |
Admits JavaScript requests by the container's measured working set: they wait when memory is elevated, and get 503 with Retry-After when it is critical. A refused Server Action did not run |
--js-external-memory-limit MIB |
ArrayBuffer memory over all isolates; a large allocation past it throws a RangeError in that request |
--native-buffer-budget MIB |
Bytes held for static files, prerendered bodies and proxied request bodies; large files are streamed in budgeted chunks |
--prerender-cache MIB |
Serves prerendered pages from their files through a bounded cache instead of reading every page at startup |
--js-young-semi-space MIB |
A young-generation floor, inside the heap limit; for CPU measurements only |
What they do not do:
- They are independent budgets, not one process limit. Some memory
(thread stacks, V8's own native allocations, buffers made in Rust) is
in none of them. - The ArrayBuffer budget is partial:
TextEncoder,
Buffer.from(string)and resizable ArrayBuffers are outside it. - Admission refuses requests under pressure. Treat its
503s as
overload. - File-backed prerendering trades memory for disk reads: a page not
in the cache is read from disk, which adds latency on a slow disk. - A small native buffer budget changes compression: with a budget
under 16 MiB, mid-sized files ar...
NextRS v0.1.0-rc.2
NextRS v0.1.0-rc.2
Prerelease. The second release candidate of NextRS v0.1.0. It is
experimental software.
NextRS serves the output of an official Next.js next build from a single
Rust binary with embedded V8. It replaces next start, not next build.
Overview
rc.2 is a compatibility, correctness and efficiency update to
v0.1.0-rc.1. It closes the two gaps that kept real applications from
running on rc.1 as they run on next start:
- builds with a Next.js deployment ID were refused at startup;
- responses were never compressed.
It also adds HTTP byte ranges, caches the gzip copies of responses that
cannot change, and makes RSC requests to route handlers behave as they do
on next start.
Installation, configuration and operation: README.md in the archive, and
release/README.md in the repository.
Scope
| Platform | Linux x86_64, glibc 2.35 or later (unchanged) |
| Next.js | 16.4.6 (primary) and 16.4.5, React 19.3.1 |
| Other Next.js 16.x | Starts with a warning (untested) |
| Other Next.js majors | Refused at startup |
| JavaScript engine | Embedded V8; isolates configurable (--isolates) |
What's new
1. Deployment ID compatibility
Builds with deploymentId in next.config (or NEXT_DEPLOYMENT_ID at
build time) now start and are served as next start serves them:
- the routes-manifest
onMatchHeadersrules that Next.js 16.4.6 writes are
applied asnext startapplies them, so RSC and/_next/dataresponses
carryx-nextjs-deployment-id; - the JavaScript runtime gets
NEXT_DEPLOYMENT_IDasnext startsets it; - client navigation stays client-side within a deployment, and a response
from another deployment makes the client load the page in full (the
version-skew signal), as withnext start; - a malformed or unknown
onMatchHeadersentry is refused at startup
rather than ignored.
rc.1 refused these builds at startup.
2. Gzip HTTP compression
Responses are compressed as next start's compression middleware
compresses them, with the same switch: compress in next.config
(default true).
- gzip, for compressible types (HTML, RSC payloads, JSON, JavaScript, CSS,
SVG and other text) from 1 KiB, and for streamed responses; - streaming is preserved: each chunk is compressed and flushed before the
next, so streamed HTML, RSC and partial prerendering arrive as
progressively as without compression; Vary: Accept-Encodingon every compressible response;- never compressed: HEAD,
204/304, partial responses, images,
already-encoded bodies andCache-Control: no-transform.
3. A bounded cache of compressed immutable responses
A response whose bytes cannot change while the server runs is compressed
once, and the compressed copy is reused:
- files under
/_next/static, keyed by path and file identity (a file
replaced on disk is compressed again); - prerendered App Router pages (HTML, RSC payloads, segment prefetches)
served from the build.
Nothing dynamic or personalized is cached: SSR, route handlers, Server
Actions, streamed RSC, ISR, partial prerendering, Draft Mode, public/
files and image optimizer output are compressed per request.
--compression-cache MIBbounds the memory, 32 MiB by default;
least recently used copies are dropped beyond it, and bodies over 4 MiB
are not cached;--compression-cache 0turns the cache off;- concurrent first requests for one response compress it once;
- hits, misses, evictions and bytes held are on the metrics endpoint
(nextrs_compression_cache_*).
4. HTTP byte ranges
Files under /_next/static and public/ answer a single byte range with
206 Partial Content and advertise Accept-Ranges: bytes, as on
next start. Only the requested bytes are read from disk.
If-None-Match and If-Modified-Since are evaluated first, so a
revalidation is a 304 whatever the range.
5. RSC route-handler parity
An RSC request (rsc: 1) to an App Router route handler is now validated
as next start validates it, including its redirect. A repeated rsc
header is no longer treated as an RSC request, and
experimental.validateRSCRequestHeaders: false is honoured.
Performance
Measured on the local benchmark fixture, on one x86_64 machine, with a warm
cache. These numbers compare the final rc.2 code with the earlier rc.2
implementation, which compressed every response on every request. They are
not cloud measurements and are not a performance guarantee.
| Workload (gzip clients) | Earlier rc.2 | rc.2 | |
|---|---|---|---|
| Prerendered HTML page | ~22.0k req/s | ~133.2k req/s | 6.1× |
| 229 KB static JavaScript chunk | ~984 req/s | ~24.8k req/s | 25× |
| Every static JS/CSS file, round-robin | ~7.4k req/s | ~53.5k req/s | 7.3× |
- Compression CPU per repeated immutable response fell 8.4× (prerendered
page) to 33× (the chunk). - The first gzip request for a response costs what it did before; after
that, one miss per distinct response per process. - Responses to clients that do not accept gzip, and dynamic responses (SSR,
RSC, JSON, streaming), are unchanged within run-to-run spread. - A cache much smaller than the set of hot assets gets no hits and is about
9 % slower than no cache. The default 32 MiB held Velasia Airways' whole
static set (465 KB compressed) about 70 times over.
Compatibility and correctness
Tested against next start on Next.js 16.4.6 (and 16.4.5) on Linux:
- the HTTP compatibility suites, including a deployment-ID build of the
fixtures and a browser deployment-ID test; - 480 RSC requests to route handlers, each equal to
next start's answer; - byte ranges, conditional requests and compression, checked response by
response; - streaming and partial prerendering, Cache Components, Server Actions.
NextRS does not claim compatibility with every Next.js application. The
public matrix is engineering/compatibility.md.
Intended differences from next start
| Behaviour | next start |
NextRS rc.2 |
|---|---|---|
| ETag of a compressed response | Strong ETag kept | Weak (W/"…"); If-None-Match still revalidates with 304 |
Accept-Ranges on a compressed response |
Kept | Removed |
| Encodings | gzip and deflate | gzip only; a client that accepts only deflate gets the response uncompressed |
| Cached gzip response | Streamed chunked | Sent with Content-Length |
Partial (206) response to a gzip client |
Partial body gzipped under an identity Content-Range |
Always the uncompressed bytes (identity), so Content-Range describes what is sent |
Unsatisfiable range (bytes=<size>-, bytes=-0) |
500 |
416 with Content-Range: bytes */<size> (RFC 9110) |
Malformed range (bytes=abc, bytes=5-2) |
500 |
Ignored: the full 200 |
| Suffix range longer than the file | 500 |
206 for the whole file |
HEAD with Range |
206 headers |
Ignores Range, describes the full response |
If-Range |
Weak comparison; any later date matches | Strong comparison: a static file's weak ETag never matches, and a date matches only the exact Last-Modified. With gzip negotiated, treated as not matching |
| Deployment ID source | next.config evaluated again at start |
The build's deploymentId; start both servers with the build's ID |
Remaining limitations
multipart/byterangesis not implemented: several ranges get the full
200, as withnext start.If-MatchandIf-Unmodified-Sinceare not evaluated for static files
(next startanswers500when they fail).public/files are compressed per request and never cached, because they
can change while the server runs.- On a cache miss the whole body is compressed before it is sent: about
4 ms of time to first byte for a 229 KB chunk, once per response per
process. - Server-side skew routing between deployments is not provided (nor is it
bynext start).
The rc.1 limitations are unchanged otherwise: Node.js APIs are a subset
(no network modules, child_process, native addons or zlib streams),
Web Crypto is partial, JavaScript state is per isolate and caches per
instance, mutations are dispatched at most once, forwarded headers are
permissive by default, and there is no access log or request ID. The full
list is in README.md, section 18.
Validation of this candidate
This archive's binary has SHA-256
87d9d871a4abd727bf96597959734ada97d173d1ec0ed979616bb2b6fca86d22. The
release workflow built it from commit 11c27c4 (run 44921294451, rustc
1.98.0, dist profile). That run passed all 14 jobs on this binary:
- formatting, Clippy, the workspace tests and
cargo audit(441 crate
dependencies); - the compatibility suites against
next start(Next.js 16.4.6): 48 of
48 at 1 isolate and 48 of 48 at 4 isolates. They include the real-world
proxy applications (next-intl pathnames and domains, a platform proxy,
jose JWKS, Auth.js 5,@vercel/otel); - the runtime-file audit: 48 requests, all
200, 964 distinct paths,
no access to the Cargo home, rustup, a target directory or the source
tree; - clean installs on Ubuntu 22.04, Ubuntu 24.04 and Debian 12 (slim), in
fresh containers that hold only the archive and prebuilt applications; - the npm package: packed from the archive, verified byte for byte,
deterministic, with its negative tests; - npm and pnpm installs on the same three images, and refusal on
glibc 2.31 and on musl; - the documented Docker example (
examples/docker).
CI (ci.yml) is green on 11c27c4. The archive itself was packaged from
this exact binary, without recompiling, by a candidate-mode run of the
release workflow on the release commit, which repeated every gate.
The same server code, built locally. Commit 11c27c4 differs from
c697c1e only in the version number and a source comment. A local release
build of c697c1e passed the following:
- the workspace tests (355);
- the compatibility suites (59 of 59) and the deployment-ID suite (16 of
...
NextRS v0.1.0-rc.1
NextRS v0.1.0-rc.1
Prerelease. This is the first release candidate of NextRS v0.1.0, the
project's first release. It is experimental software.
NextRS serves the output of an official Next.js next build from a single
Rust binary with embedded V8. It replaces next start, not next build.
npx next build
nextrs start . --js-runtime embedded-v8Installation, configuration and operation: README.md in the archive, and
release/README.md in the repository.
Scope
| Platform | Linux x86_64, glibc 2.35 or later |
| Next.js | 16.4.6 (primary) and 16.4.5, React 19.3.1 |
| Other Next.js 16.x | Starts with a warning (untested) |
| Other Next.js majors | Refused at startup |
| JavaScript engine | Embedded V8; isolates configurable (--isolates) |
The release compatibility contract classifies every capability as
supported, partial, experimental, unsupported or not tested. It is in
docs/research/release-compatibility-matrix.md of the source tree, and its
public summary is engineering/compatibility.md.
Highlights
- App Router: server rendering with RSC streaming, Server Actions, ISR
and on-demand revalidation, Cache Components and partial prerendering. - Pages Router:
getServerSideProps,getStaticPropswith ISR, API
routes, i18n, Preview Mode. proxy.tsand middleware (Node.js runtime), rewrites, redirects and
headers.next/imageoptimization in Rust, with nosharp, and memory
admission.- Shared data and response cache across isolates, optionally persisted
with--cache-dir. - Outbound
fetchbehind an explicit allowlist, with SSRF protection. - Operations:
- health and readiness probes;
- Prometheus metrics;
- JSON logs;
- graceful shutdown;
- bounded admission with
503instead of unbounded queues.
Validation of this candidate
Every result below was measured on this archive's binary, SHA-256
44f04e586c7dc9eb0b8f69dfd992143f725472aa5f3619df5a4039d77d2c6956, built by
the release workflow from commit 711d77f (rustc 1.98.0, dist profile).
- Clean installs on Ubuntu 22.04, Ubuntu 24.04 and Debian 12 (slim).
Each ran in a fresh container whose only content besides the distribution
image was this archive and prebuilt Next.js applications: no Rust, no
Node.js, no Cargo registry, no source tree, and no CA bundle. The server
ran as an unprivileged user, from a read-only application directory, at
1 and 4 isolates. Checked: install, version, help, readiness, dynamic
SSR, RSC payloads, a streamed body, Server Actions (with two concurrent
identities), Cache Components and partial prerendering, the Pages
Router (getServerSideProps,/_next/data, API routes), static files,
image optimization (WebP and AVIF, withoutsharp), Auth.js
credentials sign-in and sessions (Web Crypto), outbound TLS with the
bundled roots, the outbound allowlist, cache-directory permissions,
metrics and graceful shutdown. - No build-machine files at run time. A system-call audit of the
binary, run where the Cargo registry and the source tree exist, records
no access to either. - CI and the release workflow are green on
711d77f: formatting,
Clippy, tests andcargo audit(no known vulnerabilities), and the
compatibility suites againstnext start(Next.js 16.4.6 at 1 and 4
isolates, 16.4.5 at 1) on this binary. - The release workflow on the final code (run 44668705968). It packaged
this exact binary without recompiling, and passed every job:- the runtime-file audit;
- the compatibility suites at 1 and 4 isolates;
- clean installs on all three distributions;
- the npm package, installed with npm and pnpm on Ubuntu 22.04,
Ubuntu 24.04 and Debian 12; - refusal on glibc 2.31 and musl;
- the documented Docker image.
- The local compatibility matrix ran on this binary, at 1 and 4
isolates: the pinned and 16.4.5 suites, the real-world proxy
applications, four independent applications, and the browser suites.
Not repeated on this binary, by the maintainer's decision for this
release candidate:
- The six-hour soak. A soak of 6 h 13 min at 4 isolates, with mixed load
and Velasia Airways, ran on the previous build of this candidate. That
build is withdrawn, because it read JavaScript from the build machine's
Cargo registry. This binary differs from it only in embedding that same
JavaScript. - Velasia Airways' Playwright certification, the forwarded-header matrix
and the fault-injection tests. Velasia Airways will be validated with this
release candidate's published npm package. Results will be reported
before v0.1.0.
The gate record is in the Phase 3D final validation report, a local
engineering record.
Version note
The workspace version was set to 0.6.0 by mistake at the end of Phase 3C
(commit ba7b43e). That version was never tagged or published. The first
release is v0.1.0, and this candidate reports nextrs 0.1.0-rc.1.
Known limitations
- Node.js APIs are a subset.
- Node's network modules (
http,net,dns),child_process,
worker_threads,vm, native addons andzlibstreams are
unavailable. - Database drivers that need TCP sockets do not work.
- Node's network modules (
- Web Crypto is partial. These throw an explicit error:
deriveKey,
key wrapping, ECDH, RSA-OAEP, AES-KW, P-521, and RSA key generation. - Timers fire about 1 ms later than Node's, because of Tokio's timer
granularity. - JavaScript module state is per isolate. Caches are per instance and
are not shared across processes. - Mutations are dispatched at most once.
- A Server Action whose isolate fails gives a
502, with an ambiguous
outcome. - Use idempotency keys where effects must happen exactly once.
- A Server Action whose isolate fails gives a
- Forwarded headers are permissive by default, as on
next start. Use
--trusted-proxyor--strip-forwarded-headersin production. - Pages Router tail latency. The proxied open-loop p99 is a documented
GC trade-off. - Image transformation throughput at the default settings.
--image-concurrencydefaults to half the CPUs. At that setting,
transformations run at about 0.67× ofsharp's rate on the measured
workload.- Each transformation uses about 20 % less CPU than
sharp's. - With
--image-concurrencyequal to the CPU count, NextRS transforms
about 1.3× as many images per second asnext start, with a fifth of
its memory. - Raise the setting on image-heavy deployments that have CPU to spare.
- Not available yet:
- a per-request access log or request ID;
- response compression;
- edge-runtime routes and middleware;
- interception routes.
Distribution
GitHub release archive. This archive.
npm. The package @nextrs/cli@0.1.0-rc.1, under the dist-tag next:
- it is packed from this archive, and its binary is identical byte for
byte; - it is published with npm provenance;
- it has no install scripts;
- it does not need Rust or Cargo.
npm install -D @nextrs/cli@0.1.0-rc.1 # or: pnpm add -D @nextrs/cli@0.1.0-rc.1NextRS is not on crates.io; the crate named nextrs there is an unrelated
project.
Verifying the download
sha256sum -c nextrs-v0.1.0-rc.1-linux-x86_64.tar.gz.sha256BUILD-INFO.json in the archive records the source commit, compiler
(rustc 1.98.0), Cargo profile (dist) and the binary's SHA-256.
Rebuilding the same commit does not produce a bit-identical binary. The
published binary is the one that went through the validation above.
Reporting security issues
Privately, through GitHub's private vulnerability reporting. See
SECURITY.md. Please do not open public issues for vulnerabilities.