Skip to content
GigadriveDocs

Next.js

What Gigadrive Network configures for a Next.js build, from the cache handler and the image loader to the single standalone server.

Next.js is the one framework Gigadrive Network integrates with through a build adapter rather than a set of default paths. The adapter attaches itself to next build, so caching, image optimization and the edge routing plan are configured without anything in your repository changing.

What is detected

next in dependencies or devDependencies, at the highest priority of any preset. The deployment is then configured from .gigadrive/nextjs.json, the manifest the adapter writes when the build completes, rather than from static defaults.

The following behavior applies to Next 16.2 and newer. On an older release the adapter only forces output: 'standalone', and none of the injections happen.

What the adapter configures

  • One Function for the whole application. output: 'standalone' is set for you, and the standalone server is provisioned as a single Function named next-server with 1024 MB and a streaming /* route. Its maximum duration is the largest maxDuration any of your route segments declares, and 30 seconds when none do.
  • A cache handler, injected when your next.config does not already set cacheHandler. ISR, revalidateTag and use cache then write to a cache the whole deployment shares instead of the local filesystem, so a revalidation triggered by one invocation is visible to every later one. The in-memory cache is set to zero in that case, since the shared cache is the source of truth.
  • An image loader, injected when images.unoptimized is not true, images.loader is default, and you have not set your own loaderFile. next/image sources are then rewritten to /_gigadrive/image/... and answered by Image optimization. Sources ending in .svg are passed through untouched, because no optimizer rasterizes SVG.
  • Your next.config image settings as the deployment's image policy. remotePatterns, localPatterns, qualities, formats, minimumCacheTTL, dangerouslyAllowSVG, contentSecurityPolicy and contentDispositionType carry over, and deviceSizes plus imageSizes become one sorted width list. Setting images.unoptimized emits no policy at all.
  • .next/static as a single immutable edge prefix at /_next/static/, rather than one asset entry per hashed chunk. Files in public are published individually at their own paths.
  • A stable Server Actions encryption key for the deployment, plus NEXT_DEPLOYMENT_ID, injected as build environment variables you cannot override.
  • .next/cache wired into the build cache, so an incremental build reuses the previous deployment's work.

Fully prerendered pages are requested once after publish, so the CDN is warm before your first visitor arrives.

Static exports

A project built with output: 'export' gets no Function. The contents of out are published as static assets, and each index.html is mapped onto the route path its directory represents, so out/blog/index.html answers /blog.

Next.js documents its own configuration at nextjs.org/docs.