A Node.js project uses package.json to record project metadata, dependencies, and npm scripts. Create one in a new project directory with `npm init -y`; the `-y` option accepts default field values that you can edit later. section 2.6.1
As the project grows, update the manifest for the job at hand:
- Install an application dependency with `npm install express`. npm records it under `dependencies` and installs package code under `node_modules`. The older `--save` flag is no longer needed for this behavior. section 2.6.2
- Add `"start": "node src/index.js"` under `scripts` to launch the service with `npm start`. This gives callers a standard command without requiring them to know the entry-point path. section 2.6.7
- Add nodemon under `devDependencies` and a `start:dev` script for live reloading. Run that custom script with `npm run start:dev`; install only production dependencies with `npm install --omit=dev` when development tools are unnecessary. section 2.6.8 section 2.6.7
Listing 2.7 Adding a start script for development
{
"name": "example-3",
"version": "1.0.0",
"description": "",
"main": "src/index.js",
"scripts": {
"start": "node src/index.js", #1
"start:dev": "nodemon src/index.js" #2
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"express": "^5.0.0-beta.1"
},
"devDependencies": { #3
"nodemon": "^2.0.18" #4
}
}
The working manifest places Express in `dependencies`, nodemon in `devDependencies`, and separate launch commands in `scripts`. section 2.6.8
Scripts can also provide a consistent test command: a `test` script runs Playwright through `npm test`. If the entry point moves into `src`, update its location in package.json rather than leaving the manifest pointing at the old path. section 9.8.6 section 2.6.3




