1. Concept library
  2. Backend with Node.js
  3. Module 1: The Node.js runtime

Concept

npm and package.json

package.json names the project, its scripts and its dependencies; package-lock.json pins the exact versions installed. npm scripts are the standard way to run the build, tests and the server.

What a session covers

The tutor works through these with you, in conversation and code. A session ends when you have shown them, not when a video does.

  1. Explain what package.json and the lock file each record
  2. Write scripts for dev, test and start
  3. Spot npm install in CI and replace it with npm ci

In practice

A few lines that show npm and package.json doing its job.

JSON
{
  "name": "orders-api",
  "type": "module",
  "scripts": {
    "dev": "node --watch src/server.js",
    "test": "node --test",
    "start": "node src/server.js"
  },
  "dependencies": { "fastify": "^5.0.0" },
  "devDependencies": { "eslint": "^9.0.0" },
  "engines": { "node": ">=22" }
}

The common mistake

Watch for

Running npm install in CI instead of npm ci. Install may update the lock file and pull a different version than you tested; ci installs exactly what the lock says.

What to know first

Your roadmap puts these before npm and package.json, unless you already know them.

How it stays learned

Once a session shows you understand npm and package.json, it comes back for review. Each review takes a minute and tells the memory model how well you still know it.

  1. Day 3First recall, while it is fresh
  2. Day 7Second, a week on
  3. Day 18Last, when it has settled

Where it leads

Topics that build on npm and package.json.

Previous in the module← Modules in Node