Next.js .gitignore Template
Next.js .next build output, cache, and exported static directory. Generated and merged deterministically with upstream GitHub repository patterns to keep your repository clean of package directories, temporary build artifacts, and local environment files.
Interactive Stack Generator
Open in Full GeneratorNext.js .next build output, cache, and exported static directory
### Next.js #### See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies/node_modules/.pnp.pnp.js # testing/coverage # next.js/.next//out/ # production/build # misc.DS_Store*.pem # debugnpm-debug.log*yarn-debug.log*yarn-error.log* # local env files.env*.local.env # vercel.vercel # typescript*.tsbuildinfonext-env.d.ts Raw Next.js .gitignore
Crawlable upstream source template# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies/node_modules/.pnp.pnp.js # testing/coverage # next.js/.next//out/ # production/build # misc.DS_Store*.pem # debugnpm-debug.log*yarn-debug.log*yarn-error.log* # local env files.env*.local.env # vercel.vercel # typescript*.tsbuildinfonext-env.d.ts Key Pattern Breakdown
Dependencies & Packages
Excludes installed package directories and third-party vendor files that should be restored via package managers.
Build & Compilation Artifacts
Ignores compiled binaries, intermediate object files, and build output directories generated during development.
Environment & Secrets
Prevents leaking sensitive local credentials, API keys, database URLs, and environment configuration files.
Cache & Temporary Files
Ignores compiler caches, test runner coverage data, and transient temporary scratch files.
System & Editor Files
Filters out operating system metadata and workstation-specific editor configuration folders.
Source & Verification
Place this file in the root directory of your project as .gitignore. Changes take effect on newly added or untracked files.