What a stack is
After today, you can explain what a stack is, name its four layers, and predict which layers a feature request will touch.
Dip your toes 1 min
A stack is the set of layers a product runs on, from the screen you touch down to the computers in a data center. Most products have four. The frontend is the code on your device that draws the screen. The backend runs on the company’s servers, computers that answer many users at once, and makes decisions. The data layer stores information, and the infrastructure is the machines and networks under everything. Tap play on Spotify, and the app asks Spotify’s computers whether your account may play that song. They check stored records, and only then does the app fetch the audio. Those layers are why requests differ so much in cost. A new button label stays on the screen and is quick to change. Sorting playlists by mood touches every layer, so it takes far longer.
The full lesson 9 min
Why this exists
Tap play on Spotify and a song starts in about a second. It works the same on a phone, in a car, in a browser tab, and on a smart speaker. Behind that one tap sit thousands of engineers, millions of lines of code, and a fleet of computers. No single person understands all of it, and no single program does all of it.
Teams handle that size by splitting the product into layers. Each layer has one job, and each one talks mostly to the layers next to it. The people who build the play button don’t need to know how audio files are stored. The people who store audio files don’t need to know what the play button looks like. That separation lets a company change one part of the product without breaking the rest.
What it is
A stack is the set of layers a product runs on, from the screen you touch down to the machines in a data center. Engineers draw it as a pile of boxes, with the user at the top. The names vary from company to company, but almost every product has the same four layers.
- Frontend. The code that runs on your device and draws what you see. On Spotify, that’s the app on your phone or the web player in your browser.
- Backend. The code that runs on a server, a computer, or a program running on one, that answers requests from many users at once. It makes the decisions, like whether your account can play this song in this country.
- Data. The databases, programs built to store and find information fast, plus storage for large files. Your playlists live here, and so do the audio files.
- Infrastructure. The computers, networks, and cloud accounts the other layers run on. The cloud is computing power you rent from a company like Amazon or Google instead of owning the machines.
Most stack diagrams add a column on the side for third-party services, which are products other companies run that you plug into yours. Card payments through Stripe and maps from Google are common examples. They aren’t a layer of your stack, but your stack depends on them.
Here’s a simplified version of the play button again, layer by layer. The Spotify app on your phone shows the button and sends a message to Spotify’s backend when you tap it. The backend checks your account and the song’s license against records in a database. It tells the app where to fetch the audio file, and the app starts playing it. All of that backend and data work runs on Google Cloud, which Spotify began moving to in 2016.
Why doesn’t the app decide on its own whether you can play the song? Because the frontend runs on a device the company doesn’t control. Anyone can inspect or alter the code running on their own phone or browser. So anything that matters, like who can play what, what something costs, or who can see which data, gets decided on the backend. The frontend can hide a button, but only the backend can enforce the rule behind it.
The phrase “full stack” comes from this picture. A full-stack engineer works in both the frontend and the backend. The distinction is real because the layers use different languages, different tools, and different ways of failing. Most engineers specialize in one layer. Full-stack roles are most common at small companies, where there aren’t enough people to split the work.
You’ll also hear “client” for the frontend side and “server-side” for the backend. A client is any program that asks a server for something, like the Spotify app or your browser.
You’ll also hear “stack” used a second way. “Our stack is React, Node.js, PostgreSQL, and AWS” lists the specific tools filling each layer, which people call the tech stack. In that sentence, React draws the frontend and Node.js runs JavaScript code on the backend. PostgreSQL is a popular database, and AWS (Amazon Web Services) is Amazon’s cloud.
How it shows up in your work
In a planning meeting, the number of layers a request touches is a rough guide to its cost. Changing the label on a button is a frontend change. On the web it can ship the same day; in a phone app it waits for the next release. Letting Spotify users sort a playlist by mood touches every layer.
A mood sort needs a new control on the screen and new backend logic. It also needs new data stored for every song, and more computing power to calculate it. When an engineer says “that’s a backend change,” they’re telling you something about scope.
When something breaks, the first question engineers ask is which layer broke. Say your Instagram feed shows up blank. The frontend might be drawing it wrong, the backend might be sending nothing, the data might be missing, or the infrastructure might be down. Good bug reports help narrow it down. Note whether a refresh fixes it, whether it happens on every device, and whether other people see it too.
Larger companies organize teams around layers. A platform team, a group that builds shared tools for other engineers, often owns the infrastructure. A frontend team might own the app, while a separate team owns each major piece of the backend. Knowing which layer a change lives in tells you whose roadmap it has to get onto, and who needs to be in the review.
The one thing people get wrong
“We’re a React and Postgres shop” sounds like a description of the system. It’s really a list of brand names, the tools filling the layers today. Tools inside a layer change more often than you’d think. When Spotify left its own data centers for Google Cloud, its infrastructure tools changed completely, and the four layers stayed where they were.
The decision that shapes a product is which layer does a job. Take search filters. If the frontend filters results, it feels instant, but it only works on what’s already been loaded to the device. If the backend filters, it can search everything, but each change waits for a message to travel to the server and back.
When engineers argue about “where this logic should live,” they’re having a stack conversation, even if no tool names come up. Those are the conversations where a designer’s input changes the outcome.
Ask an engineer this
“If we added one new field to this screen, which layers of our stack would that change touch?”
Pick a real request from your backlog, ideally a small one, and ask while you’re both looking at the screen it belongs to. Count the layers they name as the change travels down, and note whether another team owns any of them. Then ask which part would take the longest. What you hear is a first, honest version of the stack for your own product. Sketch Figure 4 and write the tools they mention into each slot.
Terms from today
- Stack
- The set of layers a product runs on, from the code that draws the screen down to the machines in a data center.
- Frontend
- The code that runs on the user’s device and draws what they see and touch.
- Backend
- The code that runs on the company’s servers and makes decisions on behalf of every user.
- Infrastructure
- The computers, networks, and cloud accounts that every other layer of the stack runs on.
- Full stack
- Describes an engineer or a piece of work that spans both the frontend and the backend.