Skip to main content

package.json Generator

Generate a new package.json from form fields: name, version, description, author, license, ESM/CJS module type, entry point, Node engine, keywords, repository URL, scripts, dependencies and devDependencies. Outputs properly ordered, valid JSON ready to drop into a new project.

Input

Lowercase, dashes/underscores/dots; may be scoped (@scope/name).

Semantic version (MAJOR.MINOR.PATCH).

ESM sets type: module and adds a module field; CJS omits both.

Used for the main (and, in ESM mode, module) field.

Sets engines.node. Leave blank to omit.

Comma-separated.

Optional. Sets repository, bugs and homepage.

Scripts

One "name: command" per line.

Dependencies

Use name@range syntax. Range defaults to "latest" if omitted.

Same syntax as above.

Output Options

Output

Generated package.json
 
Was this helpful?

Guides

Generate a complete, correctly-ordered package.json from a form instead of hand-typing it or copying one from an old project. Fill in the name, version, description and license, choose ES Modules or CommonJS, list your scripts and dependencies, and get valid, ready-to-save JSON.

What goes into a package.json?

Every Node.js project — a library, a CLI, a web app — starts with a package.json that declares its identity (name, version), metadata (description, author, license, keywords, repository), how it's consumed (main/module, type: module), which commands it exposes (scripts), and what it depends on (dependencies, devDependencies, engines). Getting the shape and key order right by hand is fiddly, especially the repository/bugs/homepage triad and nested engines object.

How to use this generator

  1. Enter a Name (lowercase, dashes/dots, optionally scoped like @myorg/my-package) and a Version (defaults to 1.0.0).
  2. Add an optional Description, Author and pick a License from the common SPDX options (MIT, Apache-2.0, ISC, GPL-3.0-or-later, or UNLICENSED for proprietary code).
  3. Choose ES Modules or CommonJS — ESM adds "type": "module" and a module field pointing at your entry file; CommonJS adds neither.
  4. Set the Entry File (used for main, and module in ESM mode) and an optional Node Engine range like >=18.
  5. Add comma-separated Keywords and a Repository URL — GitHub URLs are recognized and automatically expand into repository, bugs and homepage fields.
  6. List Scripts one per line as name: command, e.g. build: tsc. Any script name works, not just the conventional dev/build/test/start.
  7. List dependencies and devDependencies as package@range, one per line or comma-separated (scoped packages like @types/node@^20.0.0 are handled correctly). Omit the @range to default to latest.
  8. Pick an Indent (2 spaces, 4 spaces, or a tab) and optionally check Mark as private to add "private": true.
  9. Copy the result or download it as package.json.

Key order

The output follows the same convention npm init uses — name, version, description, keywords, homepage, bugs, repository, author, license, private, type, main/module, scripts, dependencies, devDependencies, engines — so the file reads the way developers expect, and empty/unused fields are omitted entirely rather than written as null or "".

Why does a scoped dependency like @types/node work?

Dependency lines split on the last @ in the entry, so a scoped package name's own leading @ is never mistaken for the version separator — @types/node@^20.0.0 correctly becomes "@types/node": "^20.0.0", and a scoped name with no version (@acme/utils) is left whole with an implicit latest range.

Does this validate the package name?

Yes — the Name field is checked against npm's actual naming rules: lowercase, URL-safe characters, no leading dot or underscore, an optional @scope/ prefix, and a 214-character limit. Invalid names are flagged before you copy the file.

Is this private?

Yes. Everything runs entirely in your browser — the fields you fill in and the generated JSON are never uploaded to a server.

package.jsonnpmnodegeneratordeveloper toolsjsonyarnpnpm

Love the tools? Lose the ads.

One payment clears every ad from your account, for good. No subscription, no tracking.