Generate a package.json with React, Next.js, Express, testing, Tailwind, and Prisma presets. Live JSON preview, copy or download. Free and in-browser.
A package.json file is the manifest at the root of every Node.js and npm project. It names the package, pins its dependencies, defines the scripts your team runs a hundred times a day, and tells Node whether to treat your code as ESM or CommonJS. This generator builds one field by field, shows the resulting JSON live as you type, and lets you copy or download the finished file. Everything runs in your browser — no registry calls, no account, nothing uploaded.
It is aimed at three situations: starting a project without running npm init and then editing the result, assembling a manifest for a stack you set up rarely enough that you have to look up the dependency names, and checking the exact shape of a field you half-remember. Fourteen presets — React, Next.js, Express, a Node CLI, a testing stack, Tailwind CSS, Prisma, authentication, UI components, forms, state management, linting and formatting, and a Turborepo monorepo — each merge in their dependencies and scripts without wiping what you already added.
module for ESM or commonjs for require(). Leave private on for anything you are not publishing to npm.package.json.Two details of the output are worth knowing. Dependencies and devDependencies are sorted alphabetically, which is what npm itself does and what keeps diffs readable. Empty fields are omitted entirely rather than written as empty strings, so you get a clean manifest rather than one padded with blanks.
| Field | Example | What it controls |
|---|---|---|
name | "my-app" | Package identifier. Lowercase, no spaces, max 214 characters, cannot start with . or _. Scoped form is @scope/name. |
version | "1.0.0" | Semantic version: MAJOR.MINOR.PATCH. Required for publishing. |
description | "An API server" | One-line summary shown on the npm registry page and in search results. |
private | true | Blocks accidental npm publish. Set it on every application and internal package. |
type | "module" | module makes .js files ESM; commonjs (the default) makes them CommonJS. |
main | "dist/index.js" | Entry point resolved when something imports your package by name. |
types | "dist/index.d.ts" | TypeScript declaration entry point. The generator only emits it when TypeScript or an @types/ package is present. |
license | "MIT" | SPDX identifier. The generator offers MIT, Apache-2.0, GPL-3.0, BSD-3-Clause, ISC, UNLICENSED, and proprietary. |
author | "Jane Doe" | Free-form author string. |
repository | {"type":"git","url":"..."} | Source location. A URL becomes the object form automatically; a shorthand such as user/repo stays a plain string. |
keywords | ["api","express"] | Registry search terms. Only meaningful for published packages. |
engines | {"node":">=18.0.0"} | Declares the Node versions the package supports. npm warns on mismatch; some CI systems and hosts enforce it. |
scripts | {"dev":"next dev"} | Named commands run with npm run <name>. Locally-installed binaries are on PATH inside a script. |
dependencies | {"react":"^19.0.0"} | Packages needed at runtime. Installed for consumers of your package. |
devDependencies | {"vitest":"^2.0.0"} | Packages needed only to build and test. Skipped by npm install --production. |
The version string next to each dependency is a range, not a fixed version, and misreading it is one of the most common sources of surprise upgrades. The Reference tab in the tool lists these; here they are with worked bounds:
| Range | Matches | Does not match |
|---|---|---|
^1.2.3 | 1.2.3 up to but excluding 2.0.0 — any minor or patch release | 2.0.0 |
~1.2.3 | 1.2.3 up to but excluding 1.3.0 — patch releases only | 1.3.0 |
1.2.3 | Exactly 1.2.3 | 1.2.4 |
>=1.2.3 | 1.2.3 and anything above it, including major bumps | 1.2.2 |
* | Any published version | — |
latest | Whatever is currently tagged latest on the registry | — |
The caret is npm’s default because semantic versioning promises that minor and patch releases are backwards compatible. That promise is not enforced by anything, which is why a lockfile matters: the range in package.json describes what you accept, while package-lock.json records what you actually installed. Commit both. If you need to reason about which range a specific version satisfies, the semver calculator evaluates the comparison directly.
One special case catches people out: for versions below 1.0.0, the caret is much stricter than it looks. ^0.2.3 allows 0.2.x but not 0.3.0, because pre-1.0 packages are assumed to break on every minor bump.
The type field decides how Node interprets a .js file. With "type": "module" you write import pkg from 'package' and top-level await works; with "type": "commonjs" or the field omitted, you write const pkg = require('package'). The extensions .mjs and .cjs override the field on a per-file basis, which is the usual escape hatch when a project has to contain both.
The practical consequence: an ESM package cannot be loaded with require() from CommonJS code without a dynamic import(). Publishing a library that a mixed audience can consume means either shipping both builds and describing them through an exports map, or picking one and stating it clearly.
Consistent script names across repositories mean a new contributor never has to read the manifest to find out how to start the project. The conventional set is dev for the development server, build for a production build, start to run that build, test for the test suite, lint for the linter, format for the formatter, and typecheck for a no-emit TypeScript pass. The presets in this generator use exactly those names.
Two npm behaviours are worth remembering. npm test and npm start work without the run keyword, while everything else needs npm run <name>. And pre and post prefixes still fire automatically — a prebuild script runs before build without any wiring.
npm init?It covers the same ground with a visual form and adds framework presets, but the two are complementary. npm init -y is faster if you want a stub to edit; this generator is faster when you want a complete manifest with the right dependencies already listed and correctly split between production and dev.
The presets carry version ranges that were reasonable when they were written, and they are starting points, not a live registry feed. Run npm outdated after installing, and check release notes before accepting a major bump.
Dependencies are needed for the code to run and are installed for anyone who installs your package. devDependencies are only needed to build, test, or lint, and are skipped by production installs. Bundlers, test runners, linters, and type definitions belong in devDependencies; a web framework your server imports at runtime does not.
types field not appear in my output?The generator only emits types when your dependency list includes typescript or a package starting with @types/. Pointing at a declaration file that a JavaScript-only project never produces would just be misleading, so the field is omitted.
private: true?Yes, for every application and every internal package. It makes npm publish refuse to run, which is a cheap guard against publishing proprietary code to the public registry by accident. Turn it off only when you genuinely intend to publish.
engines field actually enforce?By default, npm prints a warning on mismatch and installs anyway. It becomes an error if engine-strict=true is set in .npmrc. Many hosting platforms and CI images read it to pick a Node version, which is the main reason to keep it accurate.
Yes. The manifest format is shared across npm, pnpm, Yarn, and Bun. Only the lockfile differs, and each tool generates its own on first install. Workspace configuration syntax differs slightly between package managers, so check that field if you are building a monorepo.
No. The whole generator is client-side JavaScript. The JSON is assembled in your browser, and the copy and download actions use your own clipboard and filesystem. Nothing reaches a server.
Save it as package.json, run npm install, then add a .gitignore with the .gitignore generator so node_modules and your .env stay out of version control, and create that .env with the .env file generator.
package.json is the manifest file for Node.js projects and npm (Node Package Manager) packages. It defines the project's name, version, dependencies, scripts, entry points, and metadata. Every Node.js project — from simple scripts to complex web applications — starts with a package.json file.
This tool generates properly structured package.json files with common configurations for various project types, saving setup time and ensuring best practices are followed from the start.
| Field | Required | Purpose | Example |
|---|---|---|---|
| name | Yes | Package identifier (lowercase, no spaces) | "my-api-server" |
| version | Yes | Semantic version | "1.0.0" |
| description | No | Brief package description | "REST API for user management" |
| main | No | Entry point for CommonJS | "dist/index.js" |
| module | No | Entry point for ES modules | "dist/index.mjs" |
| scripts | No | Named command shortcuts | {"start": "node server.js"} |
| dependencies | No | Production packages | {"express": "^4.18.0"} |
| devDependencies | No | Development-only packages | {"jest": "^29.0.0"} |
| engines | No | Required Node.js/npm versions | {"node": ">=20.0.0"} |
| license | No | License identifier | "MIT" |
| type | No | Module system ("module" or "commonjs") | "module" |
dependencies are required to run your application in production. devDependencies are only needed during development (testing, building, linting). When deploying, you can skip devDependencies with npm install --production.
Use type module for ESM (import/export syntax) - recommended for new projects. Use type commonjs for traditional Node.js (require/module.exports). ESM is the modern standard with better tree-shaking and static analysis.
^ (caret) allows minor and patch updates: ^1.2.3 matches 1.x.x. ~ (tilde) allows only patch updates: ~1.2.3 matches 1.2.x. Exact versions (1.2.3) never auto-update. Use ^ for most packages, exact versions for critical dependencies.
Essential scripts: dev (development server), build (production build), start (run production), test (run tests), lint (run linter). Also consider: typecheck, format, preview, db:migrate for database projects.