Skip to main content
Back to Dev generators

Dev

Mock package.json Generator

Starting a Node project correctly means getting the package.json right from the start — module type, script conventions, devDependency separation, and version ranges all matter more than they look. This tool generates a realistic example package.json to learn from or adapt. There are no inputs. The generated manifest picks a name from my-app, api-server, web-client, cli-tool, and worker, and generates a 1.x.y version. The fixed fields demonstrate real conventions: type: 'module' (ESM), a scripts block with start, test, and lint, dependencies with express and zod, devDependencies with eslint, and a MIT license. The test script uses node --test, the built-in Node test runner (available since Node 18). Copy the output into a package.json at your project root and adapt the name, scripts, and dependency list. Pay attention to the caret ranges (^4.19.0) — they allow compatible minor and patch updates but not breaking major version upgrades. For tighter reproducibility in production, use an exact version or npm ci with a committed package-lock.json.

Read the complete guide — 4 min read

How to use

  1. Choose your options above
  2. Click Generate
  3. Copy your result

Detailed instructions

  1. Click Generate to produce a package.json.
  2. Copy it into your project root.
  3. Adapt the name, scripts, and dependencies.
  4. Understand the version ranges before changing them.

Use Cases

  • Learning the package.json format
  • Scaffolding a Node project
  • Documenting project setup
  • Seeding an example manifest
  • Testing a manifest parser

Tips

  • Scripts run with npm run.
  • devDependencies are dev-only.
  • The caret allows compatible updates.
  • Adapt the manifest to your project.

FAQ

what fields does the generated package.json include

name (one of five example names), version (1.x.y), description, main (index.js), type (module, enabling ESM), scripts with start/test/lint entries, dependencies (express ^4.19.0, zod ^3.23.0), devDependencies (eslint ^9.0.0), and license (MIT).

what does type module do in package.json

Setting type to 'module' tells Node to treat .js files in the package as ES modules (using import/export syntax) rather than CommonJS (require/module.exports). Without this field, .js files default to CommonJS. If you need CommonJS, remove the field or set it to 'commonjs'.

what is the difference between dependencies and devdependencies

dependencies are packages your application needs to run in production. devDependencies are only needed during development — linters, test runners, build tools. Running npm ci --omit=dev in a Docker build or CI environment skips devDependencies, keeping the production install lean.

what does the caret in a version like ^4.19.0 mean

A caret allows updates to any version compatible with 4.19.0 — minor and patch updates (4.20.0, 4.19.1) but not a breaking major release (5.0.0). npm uses caret as the default range when you npm install a package. For deterministic installs, commit package-lock.json and use npm ci instead of npm install.

You might also like

Popular tools from other categories that share themes with this one.

Try these next

More free tools from other corners of the catalog, picked by shared themes.