package.json Generator
Build a complete package.json visually.
Fill in project metadata, toggle npm scripts, and select dependencies from a curated list of
popular packages. Copy the result and run npm install to get started.
Frequently Asked Questions
What is the difference between 'type: module' and 'type: commonjs'?▼
type: module makes .js files use ES module syntax (import/export). type: commonjs (the default when omitted) makes .js files use CommonJS syntax (require/module.exports). Choose module for modern Node.js projects, Vite, and libraries targeting ESM consumers. Choose commonjs for older Node.js projects or tools that don't support ESM. You can always use .mjs and .cjs extensions to override the type field for individual files.
What should I put in the 'scripts' section?▼
At minimum: 'dev' (development server), 'build' (production build), 'test' (test runner), 'lint' (code quality). Good additions: 'typecheck' (tsc --noEmit for type validation), 'format' (prettier --write), 'clean' (rm -rf dist). Keep script names consistent across projects — dev, build, test, lint are the standard npm conventions most tools expect.
What is the 'private' field used for?▼
Setting private: true prevents accidental npm publish. Use it for any project that's not intended to be a reusable npm package — apps, monorepo roots, internal tools. Without private: true, anyone with npm credentials on your machine could accidentally run npm publish and push your app to the public registry.
What is the 'engines' field?▼
The engines field specifies which Node.js (and npm/yarn) versions your package supports: { "node": ">=20.0.0" }. Tools like npm warn when installing on incompatible versions. In .nvmrc or .node-version files you set the exact version for local development; in engines you set the minimum supported version for consumers.
What is the difference between dependencies and devDependencies?▼
dependencies are packages needed at runtime — they're installed when someone runs 'npm install' in your project. devDependencies are only needed during development (tests, build tools, linters) — they're not installed when your package is used as a library. For apps deployed to servers, both are installed since you control the environment. For libraries published to npm, only list dependencies that consumers need to run your code.
Should I commit package-lock.json?▼
Yes, always commit package-lock.json (npm), yarn.lock (Yarn), or pnpm-lock.yaml (pnpm). Lock files record exact versions of every installed package, ensuring reproducible installs across machines and CI. Without a lock file, 'npm install' could install different versions on different machines. Add it to .gitignore only for globally-installed CLI tools, never for apps or libraries.
Related Products
on GumroadTypeScript Quick Reference Toolkit
5 practical reference files for TypeScript developers: cheatsheet, TS vs JS comparison, 20 utility types with real examples, tsconfig best practices template, and 15 common mistakes guide. Print it. Keep it on your desk.
Buy on Gumroad →DevPlaybook Interview Vault
210+ real technical interview questions with model answers, asked at Google, Meta, Amazon, Microsoft, Stripe, and Shopify. Covers Frontend (55), Backend (55), System Design (50), and DSA (50). Available in English and Traditional Chinese.
Buy on Gumroad →Developer Productivity Bundle
Stop rebuilding the same setup every project. 51 VSCode snippets, 40 Git aliases, 5 Docker Compose stacks, 5 GitHub Actions workflows, 5 README templates, and a dotfiles kit. Set up a professional dev environment in under an hour.
Buy on Gumroad →You Might Also Need
npm Package Stats
Look up npm package weekly download counts, unpacked size, dependency count, latest version, license, and repository link. Live data from the npm registry.
Open free tool →
pnpm Workspace Generator
GUI to configure a pnpm monorepo workspace with package globs, catalog entries, overrides, and options. Generates a ready-to-use pnpm-workspace.yaml file.
Open free tool →
NPM Bundle Size Estimator
Check npm package bundle sizes — minified and gzip. Enter multiple packages at once, see tree-shaking info, and compare sizes side by side.
Open free tool →
More Free Tools
Related Articles
Node.js ESM vs CommonJS: Migration Guide for 2026
Complete guide to migrating from CommonJS to ES Modules in Node.js. Covers interop rules, package.json configuration, TypeScript settings, dual package publishing, and common migration pitfalls.
Bun Runtime for Production 2026: Speed Benchmarks, Node.js Migration & Best Practices
Is Bun ready for production in 2026? Comprehensive guide to Bun runtime performance benchmarks vs Node.js, npm/package migration, built-in bundler, test runner, TypeScript support, and real-world production deployment best practices.
Deno 2.0 Production Guide 2026: Node.js Compatibility & Deployment
Complete Deno 2.0 production guide for 2026: Node.js compatibility, npm packages, Deno Deploy, JSR registry, TypeScript native support, and real-world migration strategies from Node.js.
Deno 2 vs Node.js 22 vs Bun: JavaScript Runtime Comparison 2026
In-depth comparison of Deno 2, Node.js 22, and Bun in 2026: performance benchmarks, npm compatibility, TypeScript support, use cases, and which runtime to choose for your next project.
Deno 2.0 vs Node.js: Should You Switch in 2026?
Honest comparison of Deno 2.0 vs Node.js in 2026. npm compatibility, JSR registry, performance benchmarks, security model, and who should (and shouldn't) migrate.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$9/mo after trial · Cancel anytime
Want the full toolkit?
Get DevPlaybook Pro
Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →