Why Does My App Lose All Its Data When I Restart It? (And What Is a Database?)
You built something, added some data, tested it, closed it down — and when you opened it again everything was gone. All the entries you added, the settings you configured, the records you created. Gone. If this has happened to you, it is not a bug and you did not do anything wrong. Your app just has nowhere permanent to store things. That is what a database is for.
If you have been building with Claude, ChatGPT, Bolt, or Lovable and have never consciously set up a database, that is probably because the AI already set one up for you without announcing it. A small file called data.db might be sitting quietly in your project folder right now. This post is not about setting one up from scratch — it is about understanding what it is so you are not lost when it comes up in an error message, a tutorial, or a conversation with a developer.
The Whiteboard Problem
Your app can hold information in two ways.
The first is in memory — temporarily, while the app is running. Fast, immediate, gone the moment the app stops. It is like writing notes on a whiteboard. While you are in the room everything is there. The moment you leave and someone wipes the board, it is gone. No trace.
The second is in a database — permanently, on disk, surviving restarts, accessible the next time you open the app. When a user signs up and their account still exists next time they log in, that information is in a database. When an app remembers your preferences, your history, your saved items — database.
A database is an organised filing system that your app reads from and writes to whenever it needs to store or retrieve something that should last beyond the current session.
One sentence worth remembering: a database is a permanent, organised place to store information your app needs to remember.
What a Database Actually Looks Like
Most databases look a lot like a spreadsheet.
Imagine a Users table with four columns: ID, Name, Email, and Signup Date. Every time someone creates an account, a new row is added. User 1 is Sarah, sarah@email.com, signed up on March 14. User 2 is James, james@email.com, signed up on March 15.
When your app needs to find Sarah's account, it sends the database a structured question — called a query — and the database returns her row in milliseconds. When Sarah updates her email, the app writes the change back. That read and write process happens constantly in any real application, invisibly, in the background.
A real app might have dozens of these tables — Users, Orders, Products, Sessions — each one storing a different type of information, all linked together.
Does Your App Actually Need One?
It depends entirely on what your app needs to remember.
If your app processes something and immediately returns a result — a calculator, a one-time script, a tool that converts a file — you probably do not need a database. Keep it simple.
If your app needs user accounts: yes, you need a database to store who those users are.
If your app needs to remember anything across sessions — preferences, history, saved items, past results: yes.
If you are building an automation script that runs once and sends an email: probably no. If you are building a tool that tracks something over time: yes.
When in doubt, ask your AI: "Does this app need a database or can it work without one?" It will give you a specific answer based on what you are building.
The Databases Your AI Uses Most
If your AI has already set up a database for you without telling you, it was almost certainly one of these:
SQLite — the most common choice for AI-written scripts and small apps. Creates a single file in your project folder — usually called data.db or app.db. No server, no setup, no dashboard. Completely invisible, which is exactly why you may never have noticed it. Good for scripts and small tools.
Supabase — the most popular choice for vibe-coded apps built with tools like Bolt and Lovable. Has a clean visual dashboard at supabase.com where you can see all your data without writing any code. Free to start. If you want to see what your app is actually storing, this is the easiest place to look.
Firebase — Google's database product. Good for apps with real-time needs like chat or live updates. If your AI used Firebase, you will have a project in your Google account at console.firebase.google.com.
PostgreSQL — the most powerful option, used in production apps at scale. Supabase runs on PostgreSQL under the hood, so if you are using Supabase you are already using it without knowing.
If you are not sure which one your AI used, ask it: "What database does this app use and where is the data stored?" It will tell you immediately.
The One Thing to Remember
Your app loses data on restart because it is storing things in memory rather than in a database. Memory is a whiteboard — fast but temporary. A database is a filing cabinet — permanent and organised. Your AI has probably already set one up for you. Understanding what it is means you will not be lost the next time it shows up in an error message.
Building something that needs to store data reliably? → Snapdock
New here? This might help: Why does my app work locally but break in production? →