stackapRequest access

Frameworks

Next.js on Stackap

Stackap recognizes a Next.js project from its dependencies, generates a Dockerfile for it, builds it on the server, and runs it as a small non-root container behind automatic HTTPS.

How Stackap recognizes Next.js

A project is treated as Next.js when its package.json lists next as a dependency. That check runs first, before any other framework test, so a Next.js app is never mistaken for a plain Node app because it also has a start script. If your repository contains its own Dockerfile, Stackap uses that and skips detection.

What Stackap builds

The generated Dockerfile builds the app in one stage and runs the result in a slimmer one, as an unprivileged user. The image for one real site came out at 164 MB.

Build-time variables follow a strict rule. Names beginning with NEXT_PUBLIC_ are passed in with their real values, because Next.js inlines them into the browser bundle and they are public by design. Every other variable is replaced by a placeholder during the build. That keeps secrets out of image layers, and it means code that reads a secret while the site is being statically generated sees the placeholder, so pages that need real data at build time have to fetch it when they are requested instead.

At runtime the container receives the real values through a private file. The container runs with no new privileges and with CPU, memory and process limits.

What a Next.js project needs

Verification status

Tested with real builds: a 31,592-page Next.js site builds on the server in about 96 seconds with a peak of roughly 2.8 GB of memory, serves the same pages as the live original (26 pages plus 64 sampled sitemap URLs compared), and passes a load test of about 410 requests per second with no errors on one copy, rising to roughly 700 with three copies on the 4-CPU box.

Still to verify: the Next.js image cache across restarts, incremental static regeneration across several servers (the cache is per server today), and Next.js features that depend on a vendor's edge network, such as edge middleware running at a distant location.

Early-access scope

Questions

Does Stackap need a vercel.json?
No. If you have one, Stackap can import its cron entries with stackap cron import, but it does not otherwise read it.
Which Next.js versions work?
We have not tested a version range. The real site that was moved uses the version it ships with, and detection only looks for the next dependency.
Can I run more than one copy?
Yes, up to eight per project on one server, set by the platform operator. They share a load balancer with failover.

Stackap is in early access. Tell us what you run and we will reply with a straight answer about whether it fits.

Ask for an invitation

Last updated .