Skip to content
framework17 active rulesVerified 2026-09-30

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

Preconfigured with Next.js
Search for templates
Quick add:
Selected1
Next.js
Selected Templates (1)
.gitignore
17 rules
### 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
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env*.local
.env
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts
38 lines•UTF-8
Deterministic

Raw Next.js .gitignore

Crawlable upstream source template
nextjs.gitignore•37 lines•UTF-8
# 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
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env*.local
.env
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts

Key Pattern Breakdown

Dependencies & Package Registries

External libraries and package manager directories installed locally rather than stored in version control.

/node_modules/.pnp.pnp.js

Build Outputs & Compiled Artifacts

Generated binary files, compilation targets, and distribution bundles that can be reliably reproduced from source.

/out//build*.tsbuildinfo

Environment Secrets & Local Overrides

Local environment configurations, secrets, and credentials intended to protect developer-specific settings from exposure.

*.pem.env*.local.env

Execution Caches & Runtime Logs

Diagnostic logs, runtime metadata, test coverage reports, and incremental compiler caches that cause noisy repository diffs.

/coveragenpm-debug.log*yarn-debug.log*yarn-error.log*

Operating System & Workspace Files

Editor-specific workspace configuration and OS filesystem metadata generated automatically by host operating systems.

.DS_Store

Source & Verification

License: CC0-1.0

Place this file in the root directory of your project as .gitignore. Changes take effect on newly added or untracked files.