How This package.json Generator Works
Fill in a package name, version, and description, pick a preset for the kind of project you're building, then this package.json generator online returns a complete, correctly structured file. It's a faster, more opinionated alternative to running npm init online and answering its prompts field by field, no interactive terminal session needed. Whether you're searching for a package.json generator or a package json generator online, this tool covers both: every preset pre-wires the scripts, dependencies, and extra fields real projects of that type need, so you're not left guessing which fields to add after the fact.
Choosing the Right Preset (Node vs React vs Next.js vs Library vs CLI)
This tool doubles as a package.json template generator: pick a preset for the project you're building and it pre-wires the scripts, dependencies, and extra fields that project type actually needs, rather than leaving you to add them by hand afterward. As a node package.json generator, the Node.js preset gives a minimal start/dev/build/test script set, TypeScript as a dev dependency, and a main entry point. As both a package.json generator react and package.json generator next.js users reach for, the React + Vite preset adds react, react-dom, Vite's build tooling, and Vitest for testing, while the Next.js preset adds next, react, react-dom, and the dev/build/start/lint scripts Next.js projects expect. The Library preset is the odd one out: instead of a main-only setup, it adds exports, types, and files, the shape npm expects from anything meant to be published and imported by other code. The CLI preset adds a bin field so the package installs as a global or npx-run command.
| Preset | Scripts | Key dependencies | Extra fields |
|---|---|---|---|
| Blank | start, test | none | none |
| Node.js | start, dev, build, test | typescript, @types/node (dev) | main |
| React + Vite | dev, build, preview, test | react, react-dom; vite, vitest (dev) | none |
| Next.js | dev, build, start, lint | next, react, react-dom | none |
| Library | build, test, prepublishOnly | typescript, @types/node (dev) | main, types, exports, files |
| CLI | start, build, test | typescript, @types/node (dev) | bin, main |
ESM vs CommonJS: Which Module Type Should You Pick?
For most new projects, comparing esm vs commonjs package.json setups isn't close. ESM ("type": "module") is where the ecosystem is heading: Next.js, Vite, and most modern tooling default to it, and it supports top-level await and native browser compatibility that CommonJS doesn't. Pick CommonJS only if you're maintaining an older codebase, publishing a library that needs to support require() consumers, or depending on a package that hasn't shipped ESM support yet.
What Gets Added Automatically (and What You Should Edit After)
Presets exist to save you from writing boilerplate, but this package.json scripts generator can't know your exact folder structure or dependency versions, so a few things are worth checking after you generate: dependency version ranges default to a recent major (^18.3.0, ^15.0.0, and so on), pin or bump them to match what you'll actually install; the main/bin paths assume a conventional src/ layout, adjust them if yours differs; and the keywords array is left empty for you to fill in with terms that help people find your package on npm.
Common Uses
Scaffolding a brand-new project without hand-typing a package.json, standardizing the scripts and fields a team expects across every new service, and quickly comparing what a Next.js versus a plain Node package.json should look like are the most common reasons to reach for this package.json generator free tool. It's also useful when converting an existing script-less project into a real npm package: the Library preset gives you the exports/types/files fields most hand-rolled package.json files are missing.