NPM Package.json Generator - Create & Validate Manifests
Generate valid, production-ready package.json files instantly with full npm validation, ESM and CLI presets, and smart exports.
Updated
What is the NPM Package.json Generator - Create & Validate Manifests?
A package.json is the heart of every Node.js and npm project — it defines your package name, version, entry points, scripts, dependencies, and publishing rules. Getting it right is critical for installs, builds, tree-shaking, and publishing to npm.
This NPM Package.json Generator lets you create a valid, production-ready package.json in seconds, without memorizing npm specs or hand-editing JSON.
What you can build
- Modern ESM libraries with
main,module,types, and conditionalexports - CLI tools with single or multi-bin configurations
- React / TypeScript libraries with
sideEffects: falsefor optimal tree-shaking - Monorepo roots with
workspaces,engines, andpublishConfig - Private apps with scripts, funding, bugs, and repository metadata
Why this beats npm init and other online generators
Most generators only handle name, version, and description. This one fixes real pain points developers complain about:
- Real npm validation for package names, scoped names, and semver
- Full spec coverage:
bin,exportsmap,files,sideEffects,os,cpu,funding,publishConfig,workspaces - Smart presets for Library, CLI, React, and TypeScript that prefill entry points correctly
- Import existing — drop or paste any package.json to edit visually instead of starting over
- Canonical key order with 2/4-space formatting for clean diffs and npm convention
- 100% client-side — your data never leaves the browser, with localStorage draft autosave
Perfect for open-source maintainers, library authors, CLI creators, and anyone tired of broken JSON and failed npm publish.
How it works
The generator transforms a visual form into a spec-compliant package.json using pure client-side validation and formatting.
1. Choose a preset
Start with Empty, Library, CLI, React, or TS Lib. Presets set sensible defaults for type, main, module, types, files, sideEffects, and bin so you don't have to look them up.
2. Fill identity & metadata
Enter package name (lowercase, URL-safe, scoped allowed like @scope/name) and semver version (1.0.0). Add description, license from the SPDX list, type: module for ESM, keywords, and files to publish. Real-time validation catches invalid names and versions instantly.
3. Configure entry points & distribution
Set main (CJS), module (ESM), types, and browser. Choose sideEffects as boolean or array for tree-shaking. Configure bin in single mode (bin: "./dist/cli.js") or multiple mode ({ "cmd-a": "./dist/a.js" }). Paste a JSON object into the Exports Map for conditional exports like import vs require.
4. Add people, repo, and publishing rules
Add author as string (Name <email> (url)) or object, repository URL (supports shorthand user/repo), homepage, bugs, funding, Node/npm/yarn engines with version presets, os/cpu allowlists, workspaces, and publishConfig access and registry.
5. Manage scripts and dependencies
Add npm scripts individually or bulk-add common sets (build, dev, test, lint). Switch between dependencies, devDependencies, peerDependencies, and optionalDependencies tabs. Version input accepts ^, ~, *, >=, workspace:*, file:, and URLs.
6. Preview, copy, and export
The right panel builds the final object, sorts keys in npm's conventional order when enabled, and stringifies with your chosen indent. Check stats for total deps and module type, then Copy JSON or Download package.json. Your draft autosaves locally.
Examples
ESM TypeScript Library
Generate a modern ESM library with dual CJS entry and tree-shaking enabled.
CLI Tool with Bin
Create a CLI package with a single executable bin and Node 18+ engine requirement.
React Component Library
Build a publishable React library package with keywords, repository and peer dependencies.
Frequently asked questions
What is a package.json file?
What is a package.json file?
A package.json is the manifest file for Node.js projects. It stores metadata like name, version, description, entry points (main, module, exports), scripts, dependencies, engines, and publishing settings. npm, yarn, and pnpm all use it to install, build, and publish your package.
Why should I use a package.json generator instead of npm init?
Why should I use a package.json generator instead of npm init?
npm init only asks for basic fields and doesn't validate ESM interop, exports maps, bin, sideEffects, or workspaces. This generator provides full spec coverage, real-time validation for package names and semver, smart presets for libraries and CLIs, visual dependency management, and import of existing files — saving hours of manual editing and preventing publish failures.
How does package name validation work?
How does package name validation work?
The tool follows npm's official rules: 1-214 characters, lowercase only, no leading dot or underscore, no spaces, URL-safe characters, scoped format must be @scope/name, and blacklist for node_modules and favicon.ico. Invalid names show an instant error before generation.
What is the difference between main, module, types, and exports?
What is the difference between main, module, types, and exports?
main is the CommonJS entry, module is the ESM entry for bundlers, types points to TypeScript declarations, and exports is the modern conditional exports map that lets you define separate entries for import, require, types, and subpaths. For best compatibility, set main + module + types and add exports for dual CJS/ESM packages.
How do I create a CLI package with a bin field?
How do I create a CLI package with a bin field?
Set the preset to CLI, then in Bin select Single mode and enter your executable path like dist/index.js and command name. If the command name equals your package name, npm allows the short string form "bin": "dist/index.js". For multiple commands, switch to Multiple mode and add key-value pairs like my-tool: ./dist/cli.js.
What does sideEffects false do?
What does sideEffects false do?
Setting "sideEffects": false tells bundlers like Webpack and Vite that your entire package is side-effect-free and safe to tree-shake. Use boolean false for pure libraries, true if it has side effects, or an array like ["*.css", "./src/polyfill.js"] to whitelist files that do have side effects.
Can I import and edit an existing package.json?
Can I import and edit an existing package.json?
Yes. Drop a package.json file onto the import zone or click Paste import and paste its JSON. The parser extracts name, version, author, repository, engines, bin, files, workspaces, funding, all dependency types, scripts, sideEffects, publishConfig, and custom fields like browserslist into the visual form for editing.
How are dependencies versions validated?
How are dependencies versions validated?
The version field accepts npm's full range syntax: ^18.2.0, ~1.2.3, *, >=18 <21, workspace:*, file:../local, link:, npm:, catalog:, https://, git+, and GitHub shorthand. The generator checks for empty values and overly long strings but stays permissive to support monorepo protocols.
Related tools
More utilities you might find handy.
.env File Generator
Quickly generate clean, properly-quoted .env files from key-value pairs — no more quoting errors or broken deployments.
.htaccess Redirect Builder
Generate error-free Apache .htaccess code for 301 redirects, HTTPS enforcement, and canonical URL routing.
ASCII Converter – Text to ASCII, Hex, Binary & Back
Convert text to ASCII codes and decode back in decimal, hex, binary, or octal — live, private, and 100% browser-based.