Mock package.json Generator
Generates an example package.json manifest for a Node project
Generated 77 words · 835 characters
See 3 examples
- Example 1
{ "name": "@tinker/bramble-gateway", "version": "6.7.8", "description": "Stateless HTTP glue with sensible defaults.", "keywords": [ "rest", "webhooks" ], "license": "Unlicense", "author": "Jane Park <jane@example.com>", "type": "module", "main": "src/main.js", "repository": { "type": "git", "url": "https://codeberg.org/tinker/bramble-gateway.git" }, "scripts": { "dev": "nodemon src/main.js", "start": "NODE_ENV=production node src/main.js", "test": "jest", "lint": "eslint . --max-warnings 0", "clean": "rimraf dist" }, "dependencies": { "fastify": "^4.26.2", "zod": "^3.22.4" }, "devDependencies": { "eslint": "^8.56.0", "jest": "^29.7.0", "nodemon": "^3.1.0", "prettier": "^3.1.1", "rimraf": "~6.0.1", "supertest": "^7.0.0" } } - Example 2
{ "name": "mosaic-cli", "version": "5.10.22-next.0", "description": "Batch-converts images and tells you how much space it saved.", "keywords": [ "scaffold", "shell", "generator" ], "license": "Unlicense", "author": "Marco Silva", "type": "module", "bin": { "mosaic": "bin/cli.js" }, "files": [ "dist", "README.md" ], "scripts": { "test": "vitest run", "lint": "eslint src", "format": "prettier -w src" }, "dependencies": { "commander": "^12.1.0", "debug": "^4.3.7" }, "devDependencies": { "eslint": "^9.15.0", "prettier": "^3.3.2", "vitest": "^1.6.0" }, "engines": { "node": ">=18.18" } } - Example 3
{ "name": "orbit-backend", "version": "4.10.6-rc.2", "description": "Rate-limited endpoints for the public developer platform.", "license": "MIT-0", "author": "Ravi Menon <ravi@example.com>", "type": "commonjs", "main": "build/index.js", "repository": { "type": "git", "url": "https://codeberg.org/tom/orbit-backend.git" }, "scripts": { "build": "esbuild src/index.ts --bundle --platform=node --outfile=build/index.js", "dev": "tsx watch src/index.ts", "start": "NODE_ENV=production node build/index.js", "test": "node --test test/", "test:watch": "node --test --watch", "lint": "eslint src", "clean": "rimraf build .cache" }, "dependencies": { "hono": "~4.6.3", "nanoid": "^3.3.7", "zod": "^3.24.1" }, "devDependencies": { "@types/node": "22.7.4", "esbuild": "0.24.0", "eslint": "^9.15.0", "rimraf": "^5.0.5", "tsx": "~4.19.1", "typescript": "^5.6.3" }, "engines": { "node": ">=22" } }
About this generator
Starting a Node project correctly means getting the package.json right from the start — module type, script conventions, devDependency separation, and version ranges all matter more than they look. This tool generates a realistic example package.json to learn from or adapt. There are no inputs. Each click picks a project kind — an API server, a command-line tool, a library, a background worker, a web front end, or a chat bot — and builds a manifest that fits it: a scoped or unscoped name, a semver version (sometimes a pre-release like 1.4.0-rc.1), a description, a license, and a type of module or commonjs. The scripts block matches the kind (dev, build, start, test, lint, format, typecheck), dependencies come from real packages commonly used for that kind of project such as express, fastify, zod, pino, commander, bullmq, react, or ws, and devDependencies only list the tools the scripts actually call. Libraries get main, exports, types, and files fields; CLIs get a bin entry; private apps are marked private. Copy the output into a package.json at your project root and adapt the name, scripts, and dependency list. Pay attention to the version ranges — a caret (^4.19.2) allows compatible minor and patch updates, a tilde (~4.19.2) allows patch updates only, and a bare version pins it exactly. For tighter reproducibility in production, commit a lockfile and install with npm ci.
How to use
- Click Generate to produce a package.json.
- Copy it into your project root.
- Adapt the name, scripts, and dependencies.
- Understand the version ranges before changing them.
Use Cases
- •Learning the package.json format
- •Scaffolding a Node project
- •Documenting project setup
- •Seeding an example manifest
- •Testing a manifest parser
Tips
- →Scripts run with npm run.
- →devDependencies are dev-only.
- →The caret allows compatible updates.
- →Adapt the manifest to your project.
FAQ
what fields does the generated package.json include
Always name, version, description, license, type, scripts, and devDependencies, plus dependencies for most project kinds. Depending on the kind it adds main, exports, types, and files (libraries), bin (command-line tools), or private: true (apps). Some manifests also include keywords, author, repository, engines, and packageManager. Package versions are real published releases written with caret, tilde, or exact ranges.
what does type module do in package.json
Setting type to 'module' tells Node to treat .js files in the package as ES modules (using import/export syntax) rather than CommonJS (require/module.exports). Without this field, .js files default to CommonJS. If you need CommonJS, remove the field or set it to 'commonjs'.
what is the difference between dependencies and devdependencies
dependencies are packages your application needs to run in production. devDependencies are only needed during development — linters, test runners, build tools. Running npm ci --omit=dev in a Docker build or CI environment skips devDependencies, keeping the production install lean.
what does the caret in a version like ^4.19.0 mean
A caret allows updates to any version compatible with 4.19.0 — minor and patch updates (4.20.0, 4.19.1) but not a breaking major release (5.0.0). npm uses caret as the default range when you npm install a package. For deterministic installs, commit package-lock.json and use npm ci instead of npm install.
You might also like
Popular tools from other categories that share themes with this one.