Dev

Fake package.json Generator

A fake package.json generator gives developers a realistic, ready-to-use Node.js project manifest without the tedium of writing dependency lists from scratch. Whether you need a convincing Express API setup, a React app scaffold, or a CLI tool skeleton, this generator produces accurate-looking package.json files complete with versioned dependencies, npm scripts, keywords, and project metadata — all in seconds. The generated output mirrors the structure and naming conventions you'd see in a real-world project. Dependency names and semver ranges follow patterns from the actual npm ecosystem, so the results look authentic enough for documentation screenshots, tutorial codebases, or UI mockups that display code. Dev dependencies like ESLint, Jest, and TypeScript type packages are included by default, which is important for any example that needs to show a complete, production-style setup. Toggle them off when you only need the bare runtime dependencies — for instance, when demonstrating a minimal install footprint. Beyond tutorials, this tool is useful for generating test fixtures in package manager tooling, populating sandbox repositories, and creating plausible starting points for workshops or coding challenges where every participant needs the same baseline file without you having to maintain a real repo.

How to Use

  1. Select the project type that matches your use case (Express API, React app, CLI tool, etc.) from the dropdown.
  2. Choose whether to include dev dependencies — select 'yes' for a full project setup or 'no' for a runtime-only manifest.
  3. Click the generate button to produce a complete, formatted package.json with dependencies, scripts, and metadata.
  4. Review the output, then copy it using the copy button and paste it into your project, fixture file, or documentation.

Use Cases

  • Generating realistic package.json fixtures for npm CLI unit tests
  • Creating tutorial codebases that show a full Express API setup
  • Populating workshop starter repos so all participants share the same baseline
  • Building UI mockups or docs screenshots that need real-looking code
  • Producing seed data for tools that parse or validate package.json files
  • Creating plausible demo repositories for portfolio or job applications
  • Generating a scaffold to kick off a new project before customizing names
  • Testing dependency vulnerability scanners with varied package manifests

Tips

  • If you are generating fixtures to test a dependency parser, run the generator several times with different project types to get varied package names and script shapes.
  • For tutorial screenshots, set includeDevDeps to 'yes' so the dependencies object looks like a realistic project rather than a stripped-down example.
  • After copying the output, do a quick search-replace on the placeholder author and repository URL — it makes demo repos look much more convincing without any manual JSON editing.
  • CLI tool outputs produce a bin field in the JSON, which is useful if you need to test tooling that specifically handles executable package configurations.
  • Cross-reference the generated version numbers against npmjs.com for any packages you plan to keep in a real project — most are close but may lag a major version behind.

FAQ

What project types does the fake package.json generator support?

The generator supports Express API, React app, Next.js app, CLI tool, and library project types. Each type pulls in a different set of realistic dependencies and scripts — for example, Express projects include middleware like cors and helmet, while React projects include react-scripts and react-dom with matching JSX-oriented scripts.

Are the dependency versions in the generated package.json real semver versions?

The versions are realistic semver strings based on well-known major version ranges for each package — not random numbers. They won't always match the latest published version, but they look credible and follow the major.minor.patch pattern you'd see on the npm registry. Always pin real versions before running npm install on an actual project.

Can I use the generated package.json to start a real Node.js project?

Yes, as a template. Copy the output, update the name, version, description, and author fields to match your project, then verify the dependency versions against the npm registry before running npm install. The scripts section is particularly useful as a starting point — rename or expand entries rather than writing them from scratch.

Why would I turn off dev dependencies in the output?

Excluding dev dependencies is useful when you want to show a minimal install or when your example focuses only on runtime behavior. It also produces a cleaner file for demonstrations where the tooling setup would distract from the main concept — for instance, a tutorial focused purely on Express routing.

How do I use a generated package.json as a Jest or Vitest test fixture?

Copy the raw JSON output into a .json file inside your test fixtures directory, then import or read it with fs.readFileSync in your test. Because the structure follows the real package.json spec, it works with any parser or validator that expects a standard Node.js manifest without requiring a live npm project.

Does the generated file include a license and repository field?

Yes. The generator populates the license field with a common open-source identifier (like MIT) and includes a placeholder repository object with a GitHub-style URL. Both fields follow the package.json spec, so they pass schema validation tools without modification.

Can I generate multiple different package.json files quickly for comparison?

Yes — switch the project type dropdown between generations and click generate each time. Each output is independent, so you can create an Express version and a Next.js version back to back, then compare the dependency sets side by side. There is no rate limit between generations.