package.json generator
Answer a few questions and copy a well-formed package.json. The name and version are checked against the npm naming and semantic versioning rules, and you can pick a starter set of scripts for plain Node or TypeScript.
Runs in your browser: nothing you enter is sent anywhere.
How to use it
- Enter the package name and version. Errors appear as soon as a value breaks the rules.
- Choose module type, entry file and a set of scripts.
- Add optional fields: description, keywords, author, license and repository.
- Copy the result into
package.json, then run npm install for dependencies.
What is generated
Keys appear in a conventional order: name, version, description, private, type, main, scripts, engines, keywords, author, license, repository. Optional fields you leave empty are left out.
Example
The defaults give my-package 1.0.0 as an ES module with start and test scripts, engines.node set to >=20 and the MIT license.
Tips
- Follow semantic versioning: increase the major number for breaking changes.
- The
test script from npm init fails on purpose until you replace it with a real test command.
Frequently asked questions
What makes a valid package name?
On npm, new names must be lowercase, 214 characters or fewer, URL-safe, and cannot start with a dot or underscore. A scoped name looks like @scope/name. The generator checks this before it produces output.
What does "type" do?
"module" makes .js files ES modules (import/export); "commonjs" keeps require(). Node reads it from the nearest package.json.
Why are there no dependencies?
Versions you type from memory are often wrong. Run npm install for each package, and npm writes the real versions for you.
What does private do?
With "private": true, npm will not publish the package, which protects an application or a work in progress from an accidental npm publish.
What is the engines field for?
It declares which Node versions the package supports, for example >=20. npm only warns about a mismatch unless engine-strict is enabled.