Below the Fold

A designer’s path to creative technologist. Thirty days, ten minutes each, on how software actually gets made.

A tower on a tiny brick A tall, uneven tower of blocks balanced on one small red brick near the ground.

Dependencies

After today, you can explain what a dependency is, what npm install does, and why one upgrade can take a whole sprint.

Dip your toes 1 min

A dependency is code written outside your team that your product needs to work. Most of it comes as packages, bundles of code that anyone can install from a public catalog. Netflix doesn’t build its website’s interface from scratch. It uses React, which Meta built and gave away, and thousands of other companies do the same. Borrowing saves years of work, but each package is a bet on someone else’s code. One installed package often brings dozens of others with it. Design systems often ship as packages too. A button you fixed in yours can stay broken in a product for weeks. Each product team installs the new version only when it chooses to upgrade.

The full lesson 9 min

Why this exists

Look at any Spotify screen. It formats dates in the listener’s language, handles text in dozens of alphabets, and encrypts everything it sends to Spotify’s servers. It also lays out rows of album art that respond to a touchscreen, a mouse, and a TV remote. Writing all of that from scratch would take a team years. The home-built version would also have more bugs than code that thousands of developers have already used and fixed.

So teams borrow. They pull in code other people wrote and published, and they write only the parts that make their product different. In a typical web app, the borrowed code is far larger than the code the team wrote. That’s how a small team ships a product in months. It also means every product depends on people its team has never met.

What it is

A dependency is code from outside your team that your project needs to work. It usually arrives as a package, a bundle of code published for anyone to install. Packages live in a registry, a public catalog of packages. npm is the main registry for JavaScript, and PyPI (the Python Package Index) is the main one for Python. Most packages are open source, which means the code is public and free to use under a license.

React is the classic example. Meta built it to draw Facebook’s interface and published it as open source. Netflix and thousands of other companies now install it as a dependency. None of them wrote React, and all of them rely on it every day.

Dependencies come in two broad kinds. A library is code you call when you need it. A package that turns a date into “3 days ago” is a library. Your code stays in charge and decides when to use it.

A framework flips that relationship: it sets the structure of your app and calls your code at the moments it chooses. Next.js is a framework. It decides that a page file inside the app folder becomes a page at that address, and it decides when your code runs. Engineers sum it up as: you call a library, and a framework calls you.

A library versus a frameworkTwo pairs of boxes. On the left, your code sits on top and calls a date library below it. On the right, the Next.js framework sits on top and calls your code below it.A libraryA frameworkYour codeDate libraryNext.jsYour codeStays in chargeFormats datesDecides when code runsFills in the pagesYou call itIt calls you
Figure 1. You call a library; a framework calls you. Look at the framework on the right, which sits on top and calls your code, the reverse of the library on the left.

A package manager is the tool that installs dependencies. For JavaScript, the tool is also called npm. The first time you run npm install, it does five things:

  1. It reads package.json, the file listing the packages your project needs directly and which versions are acceptable.
  2. It asks the registry for each of those packages.
  3. It finds what each package needs in turn. These are transitive dependencies, the dependencies of your dependencies, and they can go many levels deep.
  4. It downloads everything into a folder called node_modules.
  5. It writes a lockfile, package-lock.json, recording the exact version of every package it installed.

After that, npm installs the exact versions the lockfile lists.

What npm install doesFive numbered steps. npm reads package.json, asks the npm registry for each package, receives the packages and what they need, downloads them into node_modules, and records exact versions in package-lock.json.package.jsonnpmnpm registrynode_modules/package-lock.jsonWhat the app needsPackage managerPublic catalogDownloaded codeExact versions12345ReadAsk for eachPackages andwhat they needDownloadRecord
Figure 2. What npm install does with the list in package.json. Look at the lockfile: the one output that makes every later install match.

The lockfile is why your laptop, a teammate’s laptop, and the production servers all run identical code. Without it, two installs a week apart can pull slightly different versions and behave differently. It’s common for a new web app to pull in hundreds of packages, even when package.json lists only a dozen or so.

The fan-out from direct to transitive dependenciesA bar chart with illustrative numbers. Direct dependencies, the 12 packages listed in package.json, make a tiny bar. Transitive dependencies, the 728 packages those bring in, make a bar about sixty times longer.Direct dependencies12Transitive dependencies728Listed in package.jsonWhat those packages need, many levels deepIllustrative numbers
Figure 3. The packages a team lists compared with the packages that get installed. Look at the transitive bar: almost everything in node_modules is code nobody on the team picked by name.

package.json splits its list into two groups. Dependencies are what the product needs to run. Dev dependencies are tools the team uses only while building and testing, like a testing framework. Neither group decides what users download; the build does. When someone worries a library will slow the app down, the first question is whether it ends up in the code users download.

Versions follow a convention called semantic versioning, written as three numbers like 19.1.0. The first number is the major version, and it changes when something breaks compatibility with older code. The second is the minor version, which adds features without breaking anything. The third is the patch, which fixes bugs.

“We’re moving to React 19” is a major upgrade, and it can mean rewriting parts of the app. In package.json, a version written as ^19.1.0 means “any 19 version from 19.1.0 up.” The project accepts new minor and patch versions when someone updates the lockfile, but never jumps to 20 without someone choosing to.

How it shows up in your work

Design systems are often dependencies too. Many teams publish their component library as a package, and product teams install it like any other dependency. Each product team’s lockfile pins it to one version. When you fix a button in the design system, nothing changes in the product until that team upgrades.

That’s why a fix can be done for weeks without anyone seeing it. It’s also why a product running two major versions behind its design system is so common. You know this from Figma libraries. A published library update reaches a file only when someone editing it accepts the update, like a team picking up a new package version.

A design system fix waiting on an upgradeA timeline of design system versions: 4.1.0, 4.2.0, and 4.2.1, which fixes a button. The search app’s lockfile pins 4.2.0, so its users still see the old button. The checkout app’s lockfile pins 4.2.1, so its users see the fix.Design system versions4.1.04.2.04.2.1Button fixedSearch appCheckout appLockfile pins 4.2.0Lockfile pins 4.2.1Users see the old buttonUsers see the fix
Figure 4. Two product apps pinned to different versions of the same design system. Look at the search app: the button fix exists, but its users won’t see it until that team upgrades.

Framework upgrades eat roadmap time. They take real work, and they often block other work. A feature you want might need a capability that only exists in the newest version of Next.js. The team then has to upgrade first, fix whatever the upgrade breaks, and only then build the feature. When an estimate seems huge for a small change, ask whether an upgrade is hiding inside it.

When you propose a charting or animation library, engineers weigh more than whether it works. They check its size, because more code means a slower download for every user. They check whether anyone still maintains it and whether its license allows commercial use. They also count how many transitive dependencies it would bring along. A slow yes usually means they’re doing that checking.

The one thing people get wrong

A dependency feels free. Installing a package takes one command, so it feels like nothing happened. In practice, every dependency is a long-term decision to trust someone else’s code inside your product. The costs arrive later, as upkeep, breakage, and security risk.

Two incidents made this famous. In 2016, a developer removed a tiny package called left-pad from npm. It was eleven lines long, and its removal broke builds at companies large and small, because so many other packages depended on it.

In 2021, security researchers found a flaw in Log4j, a widely used Java library for logging, which means recording what a program is doing. Attackers could take over a server by getting it to log one specially crafted line of text. Minecraft players could trigger it by typing that line into the game’s chat.

A flaw several levels downA dependency tree four levels deep. Your server app uses a web framework, a database driver, and a search library. Those bring in request helpers, a connection pool, and text tools. Text tools brings in Log4j, where the flaw lives.Your codeYou chose theseThey brought theseThose brought theseYour server appWeb frameworkDatabase driverSearch libraryRequest helpersConnection poolText toolsConfig readerLog4jThe flaw lives here
Figure 5. A flaw several levels down still ships inside your product. Look at how far Log4j sits from anything your team chose to install.

Companies spent weeks finding Log4j in their systems, often buried in code they didn’t know they had. That’s why teams now run tools that scan dependencies for known security holes and open automatic upgrade requests. GitHub’s Dependabot is the one you’ll see most, usually as a steady stream of small pull requests nobody on the team wrote.

Ask an engineer this

“Which dependency in our app would hurt the most if it broke or disappeared tomorrow?”

Expect a pause, then the framework, then something harder to spot. It might be an authentication library, which checks who a user is, or an SDK (software development kit), a company’s package for using its service. It might be a small utility that half the codebase leans on. Ask how often it gets upgraded and who decides when. Those two details show where your product’s hidden risk sits, and why some upgrades get scheduled like features.

Terms from today

Dependency
Code written outside your team that your project needs in order to work.
Library
A package of reusable code that your code calls when it needs something done.
Framework
A larger package that sets the structure of your app and calls your code at the moments it decides.
Package manager
A tool, like npm, that downloads the packages a project lists along with everything those packages need.
Lockfile
A file that records the exact version of every installed package so every machine runs identical code.
Next

Day 4: Version control

Git as a timeline of changes. Commits, branches, the main branch, GitHub, and why every team runs on it.

3

Dependencies

All 30 days