next-zonesv0.1.0

Concepts

Zone#

A zone is a normal Next.js app (the App Router, the Pages Router, or both), so it builds with next build and runs alone with next start. It declares itself in its next.config with zoneConfig. A zone never needs next-zones to run:

The shell#

The shell is the zone mounted at /. There is no special flag: it is simply the owner of /. It holds what every page shares:

A set of zones has exactly one shell.

Mount#

Every zone other than the shell owns one URL segment, its mount, such as /blog. All of its routes live under it: /blog, /blog/[id], /blog/settings… A mount has one owner. Two zones on the same mount are refused, and so is a zone on a segment the shell already serves.

Alias#

A zone can also serve a URL at the root, outside its mount, such as /post/42 for its page /blog/42. That is an alias: the page still lives under the mount, and the address bar shows the root URL.

Version#

A version of a zone is a build, not a copy of its source. Zone images are kept in a store (one folder per zone and version). Zones can switch between them, forwards or back, while the server runs.

The contract between zones#

Zones served together must share:

Shared packages may differ in version between zones.

zoneConfig sets the build options next-zones needs (for example, Turbopack scope hoisting off, so a module shared by zones loads once).

Edit this page on GitHub · Markdown