# package.json

> The settings file of a JavaScript project. It lists its name, its scripts and the packages it needs.

**Field:** Software Development  
**Category:** Files & Formats  
**Also known as:** package.json File, npm Package File

## Think of it like

Think of it like the label on a lunch box. It says whose it is and lists what goes inside.

## Definition

package.json is the main settings file of a JavaScript project. It sits in the project's top folder and is written in JSON. It gives the project a name and a version. It lists the packages the code needs, called dependencies. It also holds short commands under scripts, like dev or test. Running npm install reads this file and fetches every package.

## Example

Emma copies a project and types npm install. Every package in the file is then fetched for her.

## Example code

```json
{
  "name": "my-site",
  "version": "1.0.0",
  "scripts": {
    "dev": "next dev"
  },
  "dependencies": {
    "react": "^19.0.0"
  }
}
```

A name, a version, one script to run and one package the project needs.

## Why it matters

It lets anyone set up your project with one command. Without it, nobody knows which packages to get.

## Common mistake

Putting test tools in the main package list. They go in the dev list, so people who use your package skip them.

## Three principles

- **Who it is.** The name and version say what it is.
- **What it needs.** Dependencies list the packages to install.
- **Handy commands.** Scripts run with npm run.

## Related terms

- [npm](https://learn.benibix.com/term/development/npm)
- [Lockfile](https://learn.benibix.com/term/development/lockfile)
- [JavaScript Object Notation (JSON)](https://learn.benibix.com/term/development/json)
- [Semantic Versioning (SemVer)](https://learn.benibix.com/term/development/semantic-versioning)
- [Package Manager](https://learn.benibix.com/term/development/package-manager)
- [Task Runner](https://learn.benibix.com/term/development/task-runner)

## Taught in

- [.env Files and package.json](https://learn.benibix.com/learn/development-formats/env-files-and-package-json): File Formats, 6/11

![A box called package.json holds four parts: the name my-site, the version 1.0.0, a dev script set to next dev, and a dependency on react. An arrow marked npm run dev leads to a box that runs next dev. An arrow marked npm install leads to a node_modules folder that holds react and every package it needs.](https://learn.benibix.com/diagrams/dev2-package-json.svg)

---

Source: https://learn.benibix.com/term/development/package-json
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-18
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
