When Does Your App Actually Need a Real Database?
Not every feature needs one. The real test, what your AI builder sets up once a feature does need one, and the step people skip: switching on access rules.
Quick answer
A feature needs a real database the moment it has to remember something after the current session ends, or show one user's data to someone else. A counter that resets when the page reloads, a form that just displays a confirmation, a filter applied to content already on the page, none of that needs one. Once you do need one, most AI website builders set it up for you when you ask for a feature that stores something, and your AI agent creates the tables from your description. The first real setup step is access rules (Supabase calls them Row Level Security), switched on before any real user data goes in, not as an afterthought once something's already gone wrong.
Tools for this build
The real test: does this need to outlive the current session?
The question that actually separates "needs a database" from "doesn't" isn't how complex a feature looks, it's whether the information it deals with has to still exist after the moment it was created. A running total shown on screen, a filter applied to content already loaded, a form's own success message, none of that needs to persist anywhere; it exists for as long as the page does and nothing more. The moment a feature has to remember something specific to one visit and show it back later, to that same visitor or a different one entirely, it needs somewhere real to live. This is the same frontend/backend distinction our guide to what a frontend and backend are covers, applied specifically to where data itself lives rather than where logic runs.
Doesn't need a database vs. needs one
Doesn't need one
A counter, a filter, a form's success message:
Exists only while the page is open, resets fine on reload
Needs one
"Save my order," "remember my preferences," "show other users' posts":
Has to exist after this visit, or for someone else entirely
AI Build · aibuild.co.za
The tell in your own prompt: "save," "remember," "my account," "other users see this"
You don't need to think in database terms to notice when you actually need one. If the feature you're describing to your AI agent naturally includes a word like "save," "remember," "my account" or "so other people can see it," you're already describing something that needs to persist, whether or not you've consciously registered that yet. This is worth noticing before you prompt, not after a feature turns out to reset unexpectedly: our guide to what a database actually is covers the table/row/column shape that data will take once it's stored.
Connecting one: what your builder sets up, and what to ask
Most AI website builders now set up a database for you the first time a feature needs one. Some build on Supabase, a standard backend service built on a Postgres database. Others run their own built-in data store, where each kind of data may be called an entity rather than a table. A coding agent works the other way round: you choose the database provider, and the agent writes the code that connects to it. In every case your AI agent creates the actual tables and writes the queries from your prompts; you describe what you're storing, not the SQL.
Once a database exists, ask your AI two things: where it lives (which provider, and which country or region, since that matters under POPIA), and how you'd export the data if you ever moved. Our guide to understanding your AI-generated project structure shows where a database connection usually appears in your project's files.
The one step people skip: access rules, set in the same session you create the table
A table being real and connected doesn't automatically mean it's private. A new table may start readable by any request that reaches it, which means anyone, not just the user it's about. That's the same exposure our guide to why you can't put an API key in the frontend covers for a client-side secret, only larger: every row instead of one key. Every database has its own name for these rules. Supabase calls them Row Level Security policies; a builder with its own data store usually has a permission setting per table or entity, such as public, logged-in users only or owner only. Don't assume a new table starts private. Ask your AI to show you the rule on each table, in plain words, in the same prompt session where you create it, not as a separate task you'll get to later.
Designing a simple schema through prompting, not SQL
Describe what you're storing in plain terms, an order with a customer, a total and a status, and your AI agent produces a reasonable table structure from that description without you needing to know SQL at all. What's worth doing yourself: naming the specific fields your business actually needs in the prompt, rather than a vague request the agent has to guess the details of. "Add an orders table with customer name, total, payment status and date" gets a table matching your actual business; "add a way to track orders" gets the agent's own best guess at what that means.
Not every feature needs its own table
A quick prototype, a single-purpose tool with nothing to remember between visits, or anything genuinely disposable gets nothing from a database connection that adds real setup and real access-rule responsibility for no benefit. Building on one is worth doing the moment a feature actually needs to persist; even where your platform provisions a database by default, a feature that doesn't need to persist shouldn't get a table just because one is available. Adding a database later, once a feature genuinely needs it, costs you nothing compared with starting with one.
Where to go next
- The concept this page applies: What Is a Database?
- Still choosing a tool, and which kinds set up a database for you: How to Choose a Vibe Coding Tool.
- When a connected database stops answering, starting from the symptom: Why Is My AI-Built App Not Working?
- The same never-trust-the-frontend rule, applied to secrets: Why You Can't Put an API Key in the Frontend.
Not endorsed by the platforms we write about
AI Build South Africa is an independent resource. We're not endorsed by, or an official partner of, Supabase, Base44 or PayFast. We do participate in affiliate and referral programmes with some providers, including Base44, and this page carries a Base44 affiliate link. See our Disclaimer for the full disclosure and our Terms of Service for the wider terms.
Frequently asked questions
Isn't my AI builder already storing data somewhere?
While you're actively working in a session, yes, in a way, but that's your builder's own working state, not a real database, and it isn't guaranteed to persist the same way for every real visitor to your live app once it's deployed. Anything you want a genuine, separate user to save and see again later needs an actual connected database, not just the state your builder happens to be holding while you build.
How does a database get connected to an AI-built app?
It depends on the kind of tool. Most AI website builders set one up for you the first time a feature needs to store something, either on a standard service like Supabase or on their own built-in store. With a coding agent, you choose the database provider and the agent writes the connection code. Either way, your AI agent creates the tables and queries from your prompts; you don't write SQL yourself.
What if my builder has its own built-in data store?
Then there's no separate service to connect. Your data model lives inside the builder, often as entities rather than tables, and asking your AI agent to store a new kind of data is usually enough to create one. The trade is portability: ask how you'd export the data, and in what format, before real users depend on it.
Do I need to design my schema before prompting, or can my AI agent do it?
Your AI agent can design a reasonable structure from a plain description of what you're storing, so you don't need SQL knowledge to get started. What's worth doing yourself is naming the fields that actually matter to your app in the prompt itself, rather than letting the agent guess at your business's specific needs from a vague request.
What's the first thing I should set up once a database is connected?
Access rules (Supabase calls them Row Level Security), before you add real user data, not after. A table with no access rules is readable by anyone who can reach your database's API, not just the user it's about. Confirming the rules are genuinely on, not just assumed, is worth doing in the same session you create the table, since it's the single setting most responsible for a real data leak.
Can I add a database later, or does it need to be there from the start?
You can add one later without rebuilding what already exists, by asking your builder to set one up or connecting one yourself, at whatever point your app actually needs to persist something. Starting without one is completely reasonable for a prototype or a feature that genuinely doesn't need to remember anything between visits.
Sponsored
Want the database built in?
Base44 is one example of a builder with its own built-in data store: ask for a feature that saves something and the database comes with it, with no separate service to connect. As with any built-in store, check how you'd export your data before real users depend on it.
Try Base44 →Affiliate disclosure: AI Build may earn a commission if you sign up through this link, at no extra cost to you.
Related reading
- React Folder Structure Explained for AI-Built Apps: where a database connection actually shows up in the file tree.
- Environment Variables Not Working After Deploy: the other thing a database connection depends on, kept out of your code.
- Why a Vibe-Coded App Isn't Production-Ready Yet: a real worked race-condition bug involving a database decrement.