DevBolt
Processed in your browser. Your data never leaves your device.

How do I generate a package.json file online?

Choose a preset (Next.js, React+Vite, Node.js CLI, npm Library, Express API, Monorepo) and customize name, version, scripts, dependencies, module config, and exports. The visual builder handles ESM/CJS, bin, engines, and keywords. Download or copy the result. Everything runs in your browser.

Generate Next.js package.json
Input
Preset: Next.js App
Name: my-app
Version: 1.0.0
Private: yes
Output
{
  "name": "my-app",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "next": "^15.0.0",
    "react": "^19.0.0",
    "react-dom": "^19.0.0"
  }
}

Basic Info

Module Config

devnext dev
buildnext build
startnext start
lintnext lint
next^15.0.0
react^19.0.0
react-dom^19.0.0
typescript^5.7.0
@types/node^22.0.0
@types/react^19.0.0
@types/react-dom^19.0.0
eslint^9.0.0
eslint-config-next^15.0.0
package.json
{
  "name": "my-nextjs-app",
  "version": "0.1.0",
  "private": true,
  "type": "module",
  "main": "index.js",
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "next": "^15.0.0",
    "react": "^19.0.0",
    "react-dom": "^19.0.0"
  },
  "devDependencies": {
    "typescript": "^5.7.0",
    "@types/node": "^22.0.0",
    "@types/react": "^19.0.0",
    "@types/react-dom": "^19.0.0",
    "eslint": "^9.0.0",
    "eslint-config-next": "^15.0.0"
  },
  "license": "MIT"
}

4

Scripts

3

Deps

6

DevDeps

Press Ctrl+Enter to copy

Tips & Best Practices

Pro Tip

Use the exports field instead of main for modern packages

The 'exports' field in package.json provides precise control over what consumers can import. It supports conditional exports (import vs require), subpath exports, and prevents access to internal modules. It's the modern replacement for main, module, and types.

Common Pitfall

Semver ranges in dependencies can break your build unexpectedly

^1.2.3 allows any 1.x.x update, which can introduce breaking changes despite semver promises. Many packages don't follow semver strictly. Use a lockfile (package-lock.json) and review dependency updates deliberately rather than relying on automatic semver resolution.

Real-World Example

Define scripts for the full development lifecycle

A complete scripts section includes: dev, build, start, test, lint, format, typecheck, and clean. Add pre/post hooks like prebuild for type checking. Well-defined scripts make onboarding instant — new developers just run npm run dev.

Security Note

Audit install scripts — they run with full system access

npm packages can define preinstall and postinstall scripts that execute arbitrary code on `npm install`. Malicious packages have used this to steal credentials and crypto wallet keys. Use `npm audit` and review install scripts of new dependencies.

Frequently Asked Questions

How do I create a package.json for a new Node.js project?
Select a framework preset (Next.js, React+Vite, Node.js CLI, npm Library, Express API, or Monorepo Root) to start with recommended defaults, then customize fields using the visual editor. Configure name, version, description, author, license, scripts, dependencies, and module settings. DevBolt generates a complete package.json that updates in real time. The output includes proper exports configuration, engine requirements, and all fields formatted correctly. Download the file or copy it directly.
What is the difference between dependencies and devDependencies?
dependencies are packages required at runtime when your application runs in production — frameworks like React or Express, utility libraries, and database drivers. devDependencies are packages needed only during development — build tools like webpack or Vite, test frameworks like Jest, linters like ESLint, and TypeScript itself. When users install your npm package, only dependencies are installed. devDependencies are skipped. For applications (not libraries), the distinction matters less but helps document which packages serve which purpose.
Should I use ESM or CommonJS for my Node.js package?
Use ESM (type: module) for new projects. ESM is the JavaScript standard module system with import/export syntax, supports top-level await, enables better tree-shaking, and is the direction Node.js is moving. CommonJS (type: commonjs or no type field) uses require/module.exports and is the legacy default. For libraries published to npm, consider dual publishing with both ESM and CJS using the exports field in package.json to support all consumers. DevBolt's generator handles the exports configuration for both formats.

Related Generate Tools