Next.js Config Generator Prompt
Generate the smallest version-compatible Next.js configuration from supplied router, runtime, deployment, asset, route, build, and validation facts.
Prompt Template
You are a senior Next.js build and runtime engineer generating the smallest maintainable Next.js configuration only from the repository facts, installed versions, deployment target, router, runtime, asset requirements, route behavior, headers, redirects, internationalization, build output, and validation evidence I provide. First use the exact installed version and dated official documentation to determine whether each requested behavior belongs in next.config, application code, route handlers, middleware or proxy, the hosting platform, TypeScript, the package manager, or another tool. Treat JavaScript, MJS, and TypeScript config support; ESM and CommonJS; App and Pages Routers; Node and edge runtimes; images; fonts; static assets; base paths; asset prefixes; redirects; rewrites; headers; environment variables; transpilation; source maps; output modes; bundling; experimental flags; and hosting adapters as separate version-dependent concerns. Never invent versions, keys, defaults, imports, plugins, domains, paths, headers, security policies, environment values, platform behavior, or successful builds. Application purpose and deployment target: [details] Sanitized repository tree: [paste] Exact Next.js, React, runtime, package-manager, TypeScript, and hosting-adapter versions: [verified or unknown] Router and route layout: [App Router, Pages Router, mixed, unknown] Package module mode and supported config filename: [verified details] Existing Next.js and related configuration: [paste sanitized content or none] Development, build, start, export, type-check, lint, and test commands: [details] Runtime needs by route: [Node, edge, static, unknown] Image sources, loaders, formats, sizes, and security constraints: [verified requirements] Base path, asset prefix, trailing slash, and public URL behavior: [details or none] Required redirects, rewrites, and headers with exact source and destination rules: [details or none] Environment-variable names, exposure boundary, and validation owner: [names only; no secrets] Packages needing transpilation or bundling changes: [verified evidence] Build output and deployment packaging: [standalone, static export, platform default, other] Source-map, logging, compiler, and performance requirements: [details] Internationalization ownership: [framework config, routing library, application code, none] Experimental feature request and reason: [details or none] Exact sanitized error, warning, or unexpected behavior: [paste] Security and privacy boundary: [no secrets, private source, internal URLs, customer data, or proprietary headers] Validation available: [config load, dev server, type-check, build, route tests, deployment preview] Output scope: [new minimal config, migration, audit, troubleshooting] Provide: 1. An assumptions table marking every version, config-file format, key, path, domain, route rule, header, environment name, package, output mode, and platform behavior as verified, inferred, or unknown. 2. An ownership map placing each requirement in Next.js config, application code, route logic, platform settings, or another verified tool, citing supplied dated documentation. 3. Complete minimal content for only the required config file, using version-supported syntax and placeholders for unresolved values. 4. A module-format and filename check for JavaScript, MJS, or TypeScript based on the installed version and package mode. 5. Separate tables for images and assets; redirects and rewrites; headers and security boundaries; runtime and output; and packages or transforms. 6. An environment-variable plan that distinguishes server-only from intentionally public names without printing values or moving secrets into client bundles. 7. A compatibility review for the selected router, runtime, output mode, hosting adapter, base path, image behavior, and static generation. 8. Version-appropriate validation commands for config loading, development routing, type-check, production build, representative route and asset checks, and deployment preview. 9. A migration and rollback plan when replacing an existing config or removing deprecated or experimental keys. 10. A final audit for unsupported keys, wrong ownership, unsafe remote image patterns, open redirects, conflicting rewrites, duplicated headers, exposed variables, broken static output, secret leakage, and claims not backed by command output. Do not install packages, overwrite framework- or platform-owned settings, loosen a security boundary to make a build pass, or claim success without the available validation. Ask for missing versions and evidence or leave explicit placeholders rather than guessing.
Example Output
Verified Inputs
The supplied repository uses an exact current Next.js version, the App Router, a confirmed ESM package mode, the platform's default deployment output, one authorized remote image host, and working development and build commands. Base paths, rewrites, custom headers, package transpilation, static export, and experimental flags are not required.
Recommended Shape
Use the version-supported ESM config filename with one narrowly scoped remote image rule. Keep route behavior in the application and retain platform-default output. Omit redirects, rewrites, custom webpack logic, exposed environment values, and experimental settings because no verified requirement supports them.
Validation Boundary
Load the config, start development, test the authorized and rejected image sources, type-check, run the production build, inspect representative routes and assets, then verify the deployment preview. A successful parse alone does not prove routing, image security, or deployment compatibility.
Tips for Best Results
- ๐กProvide exact Next.js, React, runtime, package-manager, TypeScript, and hosting-adapter versions before requesting config keys.
- ๐กAssign each requirement to config, application code, route logic, or platform settings before generating a file.
- ๐กValidate config loading, development behavior, production build, representative routes and assets, and the deployment preview separately.
Frequently Asked Questions
What is the Next.js Config Generator Prompt prompt?
Generate the smallest version-compatible Next.js configuration from supplied router, runtime, deployment, asset, route, build, and validation facts. It's a free ChatGPT prompt template from our Coding collection โ copy it, fill in the bracketed variables, and paste it into your AI tool.
Which AI tools work with this prompt?
It's written and tested for ChatGPT, Claude and Gemini. Any AI assistant that accepts free-form text prompts will handle it well.
How do I customize this ChatGPT prompt?
Replace the bracketed variables โ such as [details], [paste], [verified or unknown] โ with your own details before running it. Provide exact Next.js, React, runtime, package-manager, TypeScript, and hosting-adapter versions before requesting config keys.
Is this prompt free to use?
Yes. Every prompt on PromptAtlas is free to copy, customize, and use โ no signup required.
Related Prompts
Code Review Assistant
Get a thorough, senior-level code review with actionable feedback on quality, security, performance, and best practices.
Debugging Detective
Systematically debug errors and unexpected behavior with root cause analysis and fix suggestions.
Code Refactoring Advisor
Transform messy, complex code into clean, maintainable, well-structured code with clear explanations.