Next.js config generator
Pick what your deployment needs. The file writes itself.
React Strict Mode
reactStrictModeDouble-invoke render and effects in development to surface unsafe code.
Recommended
Build output mode
outputPackage the build as a standalone server or as a fully static export.
Build directory
distDirRename the folder the build is written to.
Base path
basePathServe the whole app under a sub-path such as /docs.
Asset prefix
assetPrefixServe static assets from a CDN origin instead of your app domain.
Trailing slash
trailingSlashForce every URL to end with a slash.
Page extensions
pageExtensionsRestrict or extend which file extensions become routes.
Build-time environment variables
envInline values into the bundle at build time.
Server external packages
serverExternalPackagesv15.0Keep specific server packages out of the bundler.
Transpile packages
transpilePackagesCompile untranspiled dependencies from your monorepo or npm.
File tracing root
outputFileTracingRootPoint tracing at the monorepo root so shared files are included.
Clean build directory
cleanDistDirWipe the build folder before each build.
Allowed remote image hosts
images.remotePatternsWhitelist the hosts next/image is allowed to optimize from.
Image domains (legacy)
images.domainsdeprecatedThe old hostname whitelist, kept for migrations only.
Output formats
images.formatsModern formats the optimizer may serve.
Device breakpoints
images.deviceSizesWidths generated for images that fill the viewport.
Fixed-size widths
images.imageSizesWidths generated for images with a known display size.
Allowed quality values
images.qualitiesv16.0Restrict which `quality` values callers may request.
Minimum cache lifetime
images.minimumCacheTTLFloor for how long an optimized image is cached, in seconds.
Disable image optimization
images.unoptimizedServe every image exactly as authored.
Allow remote SVG
images.dangerouslyAllowSVGPermit SVG files through the image optimizer.
Image content disposition
images.contentDispositionTypeHow the browser is told to handle optimized image responses.
Custom image loader
images.loaderHand URL building to an external image service.
Loader file path
images.loaderFileModule that exports the custom loader function.
Security response headers
headersSend hardening headers on every route.
CORS route pattern
headersWhich routes the cross-origin rules apply to.
Allowed origins
headersOrigins permitted to call your API from a browser.
Allowed methods
headersHTTP methods accepted from other origins.
Allowed request headers
headersCustom headers other origins may send.
Allow credentials
headersLet cross-origin requests carry cookies.
Crawler control header
headersSend X-Robots-Tag to keep an environment out of search results.
Static asset caching
headersLong-lived cache rules for your own asset folders.
Hide X-Powered-By
poweredByHeaderStop advertising the framework in every response.
Disable built-in compression
compressHand gzip and brotli to nginx or the CDN instead.
Script crossOrigin attribute
crossOriginAttribute added to script tags Next.js injects.
Disable HTTP keep-alive
httpAgentOptions.keepAliveTurn off connection reuse for server-side fetches.
Redirects
redirectsSend one path to another with a real HTTP status.
Rewrites
rewritesProxy a path to another destination without changing the URL.
Skip trailing slash redirect
skipTrailingSlashRedirectStop Next.js redirecting between slashed and unslashed URLs.
Skip middleware URL normalize
skipMiddlewareUrlNormalizeGive middleware the raw, unnormalized URL.
Strip console calls
compiler.removeConsoleRemove console output from production builds.
Strip test attributes
compiler.reactRemovePropertiesDrop data-testid props from production output.
styled-components support
compiler.styledComponentsEnable the SWC transform for styled-components.
Optimize package imports
experimental.optimizePackageImportsTree-shake barrel-file packages like icon libraries.
Inline critical CSS
experimental.optimizeCssInline above-the-fold CSS and defer the rest.
React Compiler
experimental.reactCompilerv15.0Let the compiler insert memoization for you.
Partial prerendering
experimental.pprServe a static shell and stream the dynamic parts in.
Server action body limit
experimental.serverActions.bodySizeLimitMaximum payload a server action will accept.
Static generation timeout
staticPageGenerationTimeoutSeconds a single page may take to prerender.
CDN stale-while-revalidate
expireTimeSeconds a CDN may serve stale ISR content while revalidating.
Custom cache handler
cacheHandlerShare the ISR cache across instances with Redis.
In-memory cache size
cacheMaxMemorySizeBytes of ISR cache kept in process memory. Zero disables it.
Reduce build memory
experimental.webpackMemoryOptimizationsTrade some build speed for lower peak memory.
Turbopack root
turbopack.rootTell Turbopack where the workspace root is.
Ignore TypeScript errors
typescript.ignoreBuildErrorsLet the build finish even with type errors.
Skip ESLint during build
eslint.ignoreDuringBuildsDo not run linting as part of next build.
ESLint directories
eslint.dirsLimit which folders are linted during the build.
Production source maps
productionBrowserSourceMapsShip browser source maps with the production build.
Log full fetch URLs
logging.fetches.fullUrlPrint complete URLs for server-side fetches in development.
next.config.ts// Generated with the UntangleTools Next.js config generator.// File: next.config.tsimport type { NextConfig } from "next";const nextConfig: NextConfig = { reactStrictMode: true,};export default nextConfig;Next.js config generator
Stop copying next.config from your last project
Most next.config files are inherited, not written.
Copied from an old repo, missing half the comments, never quite matching the app it's pasted into.
This tool flips that. Pick your deployment, Vercel, Docker, Kubernetes, a static export, and only the settings that actually apply switch on, each with a plain explanation attached.
Every option gets checked against every other one, so the file you copy out is one that builds, not one you find out is broken five minutes into a deploy.
60+
config options covered
10
deployment presets
16
conflict and security checks
0
requests sent off your device
Walkthrough
Five steps from blank page to a finished file
Start from a preset or a blank slate
PresetsPick the preset closest to where you deploy, Vercel, Docker, a static export, and it switches on the options that setup actually needs. Rather start from nothing? React Strict Mode is the only thing on by default.
Turn on what your project needs
Search & toggleSearch by name or browse by group. Flipping an option on reveals its inputs right there, no separate settings page, so you see the effect on the generated file immediately.
Fill in the specifics that are yours
Your specificsImage hostnames, allowed CORS origins, a redirect map, whatever the option needs. Tap the question mark on any row for when to use it, when not to, and what actually breaks if you get it wrong.
Let the Issues tab catch what you missed
Auto-checkedEvery combination gets cross-checked as you go: a static export with rewrites still enabled, an open image host, credentials paired with a wildcard CORS origin. Conflicts show up before you've copied anything.
Copy or download the file
Ship itGrab it as next.config.ts or next.config.js, ESM or CommonJS. Drop it in your project root and run your usual build. Nothing here needs an account or a save step.
Under the hood
The logic behind the warnings
Every combination you switch on gets checked against every other one. These are a few of the rules actually running behind the Issues tab, written out so you can see the reasoning, not just the flag.
IF output is "export"
rewrites, redirects, response headers, and any ISR cache handler are all flagged
IF output is "export"
rewrites, redirects, response headers, and any ISR cache handler are all flagged
A static export has no server at request time, so anything that needs one has to move to whatever's actually serving the files, an S3 bucket policy, a Netlify redirects file, an nginx location block.
IF output is "export" and image optimization is still on
the build is flagged as broken, not just risky
IF output is "export" and image optimization is still on
the build is flagged as broken, not just risky
next/image's optimizer is a server route. Without it disabled, or a custom loader pointed at an image CDN, the build fails the moment it tries to render an image.
IF a wildcard CORS origin is paired with credentials
the combination is flagged as an error
IF a wildcard CORS origin is paired with credentials
the combination is flagged as an error
Browsers refuse this pairing outright, a wildcard origin can never carry cookies, so shipping it isn't risky, it's just broken from the first request.
IF an SVG host is allowed without a content-disposition set
it's flagged as a security gap
IF an SVG host is allowed without a content-disposition set
it's flagged as a security gap
An SVG can carry a script tag. Served inline from your own domain, that's stored XSS with your origin's trust. Setting the disposition to attachment closes it.
IF a Redis-backed cache handler is set but the in-memory cache isn't zeroed
you get a note about it, not an error
IF a Redis-backed cache handler is set but the in-memory cache isn't zeroed
you get a note about it, not an error
Each container still keeps its own local copy on top of the shared one, so a page revalidated on one pod can look stale on another until the local cache expires.
IF both images.domains and images.remotePatterns are configured
it's flagged as redundant
IF both images.domains and images.remotePatterns are configured
it's flagged as redundant
The old list only matches a hostname. The new one also pins protocol, port, and path, which is what actually limits who can use your image optimizer as a free resizing service.
Real setups
Four ways teams actually use this
Dashboard app on Vercel
A SaaS dashboard pulling avatars and attachments from Cloudinary, deployed straight to Vercel with no container step.
Cloudinary is the only image host allowed, console noise is stripped from the shipped bundle, and the icon library stops pulling in its entire barrel file.
Internal tool on Kubernetes
An admin tool running as several pods behind a load balancer, sharing one Redis instance for session data.
The image drops to a fraction of its original size, and every pod reads ISR pages from the same Redis cache instead of disagreeing with each other.
Docs site as a static export
A documentation site with no server-side logic at all, hosted from a plain storage bucket.
The build emits plain HTML the bucket can serve directly, with URLs shaped the way most static hosts expect them.
Public API with a locked-down front end
A REST API called only from one known front-end origin, with cookies used for auth.
Only the app's own origin can call the API from a browser, and the response carries HSTS, a frame policy, and a referrer policy by default.
Questions people actually ask
FAQ
No. Presets cover the common deployment targets, and every option comes with a short description plus a Learn more explaining what it's for. You can build a working config without knowing what outputFileTracingRoot means going in.
It's syntactically complete and cross-checked for conflicts, but it still reflects choices only you can make, which image hosts are really yours, which origins should really be trusted. Treat the Issues tab as a second pair of eyes, not a substitute for reading what you turned on.
A static export has no Next.js server running when someone visits the site, and rewrites are resolved by that server. The fix isn't in next.config at all, it's moving the rule to whatever host is actually serving the static files.
domains only checks the hostname. remotePatterns also checks protocol, port, and path, which is the part that actually stops a stranger from optimizing arbitrary images through your server. The old key still works but is on its way out.
Both. TypeScript output always uses export default, since a .ts config is treated as an ES module regardless of what your project's module setting is elsewhere. JavaScript output lets you pick ESM or CommonJS.
Origins, methods, allowed headers, and the credentials flag all merge into a single generated headers() block, grouped by the route pattern you set. If you list more than one allowed origin, it flags that you'll need middleware to echo back the matching one, since a header can only carry one value.
Only once more than one instance of your app is serving the same pages. A single server or a Vercel deployment already keeps this consistent on its own. On Kubernetes or behind Docker replicas, each container otherwise holds its own copy of the ISR cache.
No. Every option you toggle stays in your browser tab and is used only to render the file on screen. Nothing is uploaded, logged, or saved once you close the page.


