next-zonesv0.1.0

What is supported

Next.js 16.3.6, 16.3.7, 16.3.8 and 16.4.0, App Router and Pages Router. Key:

Routing#

page, layout, dynamic routes, catch-all, optional catch-all, route groups, parallel routes βœ…
loading (streaming), error, not-found βœ…
Intercepting routes (modals) βœ…
Route handlers (route.ts) βœ…
A zone's metadata routes (/blog/sitemap.xml, /blog/opengraph-image) βœ… (the root /sitemap.xml and /robots.txt are the shell's)
Mounts and aliases βœ…
The shell's proxy.ts in front of every zone βœ…
A zone's own proxy.ts β›” (move its logic into the shell's proxy)
A zone's headers, redirects, rewrites (see routing rules) βœ…
basePath, i18n, trailingSlash, assetPrefix, skipTrailingSlashRedirect, cacheComponents, partialPrefetching different from the shell's β›”
<Link> shell ↔ zone and zone ↔ zone, Back/Forward, prefetch (App Router pages) βœ… soft, state kept
<Link> to or from a zone's Pages Router page βœ… soft inside that zone; a new document to anywhere else (Next's rule between the routers; see Zones on the Pages Router)
useRouter, usePathname, useParams, useSearchParams, router.push into another zone βœ…
redirect() into another zone, notFound() βœ…
permanentRedirect, forbidden, unauthorized 🟑
New client code after a version swap, even for a page an open tab has cached βœ… (with <ZoneUpdates />)
A shared package at different versions in different zones, in one page βœ… each zone runs its own version (concepts)

Rendering and data#

Server and client components, one React βœ…
Server actions (with bound arguments) βœ…
Prerendered pages, ISR, generateStaticParams (with dynamicParams and fallback) βœ…
revalidateTag and revalidatePath across zones, unstable_cache βœ…
cookies, headers, connection βœ…
'use cache', cacheTag, cacheLife, Cache Components / PPR βœ… (cacheComponents must be the same in the shell and every zone)
Edge runtime in a zone πŸ”§ refused at install today (use the Node.js runtime)

Assets#

Client chunks, CSS modules βœ…
next/font βœ…
next/image with local images (imported, or from the zone's public/) βœ…
A zone's own images config (remote patterns…) that differs from the shell's πŸ”§ refused at install today (put it in the shell's config, which serves every zone). A zone with no images config, or the shell's, installs
A zone's public/ files, under its mount βœ… (see assets)

Process#

Instrumentation, the shell's and each zone's βœ…
A zone's instrumentation-client.ts β›” (put it in the shell)
A zone's dependencies (serverExternalPackages included), wherever its build is stored βœ… (they resolve from the shell's node_modules)
A package only in a zone's own node_modules (not hoisted by the workspace) βœ… bundled into the zone's build; 🟑 as a serverExternalPackages entry, which must be in the shell's node_modules
Zones built with a different Next or React than the server's β›”
Many requests at once across zones, several installs at once, and swaps under load βœ…
A shell with its own cacheHandler (a remote cache) βœ… (it keeps every key but the zones' pages, which stay per version)
A zone run alone (next start, next dev), with its aliases βœ… (running alone)
next dev across zones βœ… next-zones dev: HMR and soft navigation, every zone at once
Pages Router (pages/) in a zone: static pages, getStaticProps (prerendered, fallback, revalidate), getServerSideProps, its own _app and _document, live installs βœ… in every mode (Zones on the Pages Router)
A zone's pages/api/ (served at /api/…, outside its mount) β›” (route handlers under the mount, app/<mount>/…/route.ts, or the shell's)
output: "export" βœ… both modes: one static site, soft navigation between zones (build and start)
output: "standalone" βœ… both modes: the folder alone is the deploy (build and start)

Zone images#

Images entering the store by a pull from a source (HTTP, a folder, one's own), streamed and checked βœ… (zone images)
Uploading an image to Zones β›” by design: endpoints only ask Zones to pull
Pulls on a ping, for a zone with livePull βœ… (live pulls)
Images of hundreds of MB βœ… streamed: memory does not grow with the image
Images as .zip, and a repository's archive of a tag (one top-level folder) βœ…
Pulls over a shared link: stalls and dropped connections resumed with Range βœ…
service-connector as the source (fromConnector) βœ… against its documented API
A pull that would fill the disk βœ… refused before it starts, or stopped while it runs (the disk)
Pruning old images, automatically or on request βœ… (pruning)

One app#

Every zone built into one Next app (mode: "single"), served by next start βœ… (build and start)
Each zone's own @/* and its types, in that one app βœ… (types checked per zone, with its own tsconfig)
Instrumentation in that one app βœ… as on Zones: the shell's for every route, each zone's for its own
Installing a zone into it while it runs β›” by design: that is what images and Zones are for

Edit this page on GitHub Β· Markdown