Where an App's Data Lives
Welcome back, friend. So far we've toured the dining room (the front end) and the kitchen (the back end). Today we open one more door — the one the kitchen relies on most.
Because here's a question worth asking: when you close an app and open it again tomorrow, how does it still know your name? Your messages, your saved items, your settings — none of that vanished overnight. Something remembered.
That something is the database.
The pantry behind the kitchen
A database is the place an app keeps information so it can be found again later. Think of it as the pantry behind the restaurant kitchen.
A good pantry isn't a junk pile. It's organized — labeled shelves, everything in its spot. Flour here, tomatoes there. So when a cook needs an ingredient, they don't dig; they walk straight to the right shelf and grab it.
A database works the same way. Your data sits on tidy, labeled shelves, so the back end can fetch exactly what it needs in a blink. When you log in, the kitchen walks to the "users" shelf, finds your row, and pulls your name. Fast, because it's organized.
A quick word: data just means the facts an app keeps — your name, your messages, the items in your cart. Nothing fancier than that.
Two places your stuff can live
Here's a distinction that explains a lot of everyday app behavior. Your data can live in one of two places.
On your device — kept right on the phone or laptop in your hand. Like a small note stuck to your own fridge: handy, instant, but only you can see it, and only on that fridge. Apps use this for small things — which screen you last opened, a draft you're still typing, your dark-mode setting.
On the server — kept in the back end's pantry, off in a data center somewhere. Like a folder in a bank's vault: not in your pocket, but safe, shared, and reachable from anywhere. Apps use this for the things that truly matter — your account, your messages, your purchase history.
The rule of thumb: small and private and throwaway tends to live on the device; important and lasting and "must follow you" lives on the server.
Why your account follows you to a new phone
Now the payoff. You buy a new phone, install the same app, log in — and there's all your stuff. Same messages, same saved items, same everything. No setup. How?
Because the real memory was never in the old handset. It was in the server's pantry the whole time.
Your old phone was just a window looking into that pantry. Log in on a new phone, and you've simply opened a new window onto the same shelves. The phone is a viewer; the database is the keeper. 🐙
This is also why losing your phone doesn't lose your account, and why the same app shows the same data on your phone and your laptop at once. They're all windows onto one pantry.
Your turn
No code today — just notice. Pick an app you use and sort two things it remembers:
- Name one thing that probably lives on your device (a hint: it'd disappear if you switched phones without logging in — like an unsent draft or a screen setting).
- Name one thing that clearly lives on the server (a hint: it follows you anywhere you log in — like your messages or your account).
If you can tell those two apart for one real app, you understand where an app's memory actually lives.
Next, we watch the two halves actually pass notes to each other — how your tap reaches the kitchen and a plate comes back. That's How the Front and Back Talk.
Stuck or curious?
Ask Pip about this lesson — tap the porthole bottom-right.