What Happens When You Type a URL and Press Enter
DNS lookups, TCP and TLS handshakes, HTTP requests, servers, and the browser's rendering pipeline. The whole journey of a web page, explained so it finally clicks.
Read →Semantic versioning, lockfiles, npm ci, safe updates, security audits and choosing packages wisely. The habits that keep a JavaScript project installable, secure and up to date for years.
A typical JavaScript project depends on hundreds of packages once you count dependencies of dependencies. That's a huge productivity win, until an install breaks, a security alert appears, or a package you rely on gets abandoned. Good dependency habits keep that power without the pain.
Most packages follow semver: MAJOR.MINOR.PATCH.
2.4.1 → 2.4.2): bug fixes, nothing should break.2.4.2 → 2.5.0): new features, backwards compatible.2.5.0 → 3.0.0): breaking changes. Read the migration guide.In package.json, version ranges control what's allowed:
| Range | Allows |
|---|---|
"^2.4.1" |
Any 2.x.x at or above 2.4.1 (the default) |
"~2.4.1" |
Any 2.4.x at or above 2.4.1 |
"2.4.1" |
Exactly 2.4.1 |
Semver is a promise, not a guarantee. Minor releases occasionally break things, which is why the lockfile matters.
package-lock.json (or pnpm-lock.yaml, yarn.lock, bun.lock) records the exact version of every package installed, including nested ones. Commit it. Without it, two developers running npm install a week apart can get different code.
npm ci in CI and productionnpm ci
npm ci installs exactly what the lockfile says, fails if package.json and the lockfile disagree, and starts from a clean node_modules. It's faster and reproducible: exactly what you want in CI and deployments. (GitHub Actions setup.)
Use npm install when you're intentionally adding or updating packages.
npm install express
npm install -D vitest eslint
Production installs can skip dev dependencies (npm ci --omit=dev), keeping images smaller. (Docker basics.)
Dependencies left alone for two years turn into a painful, risky upgrade project. Small, frequent updates are much easier:
npm outdated # what's behind?
npm update # update within your allowed ranges
For major versions, update one package at a time, read its changelog, run your tests, and commit.
Automate the boring part with Dependabot or Renovate. They open pull requests for updates, your CI runs the tests, and you merge the green ones. Group minor and patch updates to reduce noise.
npm audit
npm audit reports known vulnerabilities in your dependency tree. Not every alert is urgent: a vulnerability in a dev-only tool that never touches user input is lower risk than one in your web server. Prioritise:
npm audit fix applies compatible fixes; be careful with --force, which can install breaking major versions. (Security checklist.)
Every dependency is code you didn't write but now ship. Before adding one, check:
Packages can run scripts during installation, which is a common route for malicious packages. Review unfamiliar packages, consider tools or settings that disable or restrict install scripts in CI, and keep your lockfile under review in pull requests.
Plugins often declare peer dependencies: "I work with React 18 or 19, but you install React." Warnings about unmet peer dependencies usually mean version mismatches between a plugin and its host library. Read them rather than reflexively forcing installs.
engines field or a .nvmrc file, so everyone uses the same runtime.Yes. The lockfile guarantees everyone, including CI and production, installs exactly the same dependency versions.
npm install resolves and may update dependencies within allowed ranges and updates the lockfile. npm ci installs exactly what the lockfile specifies from a clean slate, making it ideal for CI and deployments.
Regularly and in small batches, ideally weekly or monthly with automated pull requests from Dependabot or Renovate, plus prompt updates for serious security issues.
DNS lookups, TCP and TLS handshakes, HTTP requests, servers, and the browser's rendering pipeline. The whole journey of a web page, explained so it finally clicks.
Read →There are dozens of HTTP status codes, but about fifteen cover nearly everything. What each one means, when to return it, and the mix-ups (401 vs 403, 301 vs 302) that confuse everyone.
Read →A, AAAA, CNAME, MX, TXT and NS records in plain English, why DNS changes seem slow, and the troubleshooting commands that tell you what is really going on.
Read →