Skip to content

What is a Database? Where Your Data Lives and Why It Matters

Understand databases through the spreadsheet analogy — SQL vs NoSQL, when you need one, and which to choose.

9 min readdatabases, SQL, NoSQL, data, fundamentals
Copy The Prompt First

Use the lesson prompt before you improvise

This lesson already contains a scoped prompt. Copy it first, replace the task and file paths with your real context, and make the agent stop after one reviewable change.

Matching prompts nearby

29

When you finish this lesson prompt, use the related prompt set to keep the same supervision pattern on the next task.

This lesson promptWhat is a Database? Where Your Data Lives and Why It Matters

Understand databases through the spreadsheet analogy — SQL vs NoSQL, when you need one, and which to choose.

Preview
"Help me design the smallest safe database model for this feature.
1. List the tables or collections I actually need
2. Show the key fields and relationships
3. Explain whether SQL or NoSQL makes more sense here and why
4. Call out ownership, validation, and deletion risks
5. Stop before running migrations, destructive schema changes, or data backfills without my approval

You build a habit tracker app. Users can add habits, check them off, and see their streaks. Then someone refreshes the page and everything disappears.

What happened? The data lived only in the browser's temporary memory. Your app had no permanent place to keep it.

That permanent place is a database.

The Spreadsheet Analogy

If you've ever used a spreadsheet, you already understand the core concept of a database. A database is just an organized collection of data — like a really powerful, really reliable spreadsheet.

Imagine a spreadsheet for a bookstore with a books table, a customers table, and an orders table. That is essentially a database: rows of data, columns of fields, and relationships between records.

The difference between a spreadsheet and a database? A database can:

  • Handle millions of records without slowing down
  • Let thousands of people read and write data simultaneously
  • Keep data secure and prevent unauthorized access
  • Ensure data stays consistent (no half-saved orders)
  • Run complex searches and calculations instantly

The Two Big Camps: SQL and NoSQL

You'll hear these terms a lot. They represent two different approaches to organizing data.

SQL Databases (Structured / Relational)

SQL (pronounced "sequel") databases organize data into tables with defined structures — exactly like the spreadsheet example above. Every row has the same columns. Every relationship is explicit.

Think of it like: A filing cabinet with clearly labeled folders and a strict organizational system. Everything has its place.

Examples: PostgreSQL, MySQL, SQLite

Best for: Most applications. When your data has clear structure and relationships. When you need reliability above all else.

This is what most vibe coders should use. It's the default for good reason.

NoSQL Databases (Flexible / Document-Based)

NoSQL databases store data in a more flexible format — often as "documents" that can have different structures. One user's record might have fields that another user's record doesn't.

Think of it like: A folder of forms where each form can have different fields filled in. One user's form might include a phone number while another's does not — and the system handles both.

Examples: MongoDB, DynamoDB, Firestore

Best for: When your data structure varies a lot, when you need extreme scalability, or when you're storing complex nested data like user profiles with optional fields.

Which Should You Use?

For most vibe coding projects: SQL (specifically PostgreSQL). It's the most widely supported, the AI tools are most experienced with it, and it handles the vast majority of use cases well.

Supabase, a common default in the vibe coding world, uses PostgreSQL under the hood. So if you follow the most common path, you will probably end up with SQL anyway.

Why Does Every Real App Need a Database?

Without a database, your app has amnesia. It forgets everything the moment the user leaves. Specifically, you need a database whenever your app needs to:

Remember user data — Profiles, preferences, settings, saved items

Store content — Blog posts, products, messages, comments

Track activity — Orders, logins, analytics, history

Manage relationships — Who follows whom, which user owns which project, what items are in a cart

Support search — Finding products, filtering results, sorting data

Basically, if your app stores anything that needs to persist beyond a single session, you need a database.

Database Services for Vibe Coders

You don't need to install or manage a database yourself. Services handle all of that. Here are the ones you'll encounter most:

Supabase

The most popular choice in the vibe coding world, and for good reason. Supabase gives you a PostgreSQL database with a nice dashboard, built-in authentication, file storage, and real-time features. It has a generous free tier and excellent documentation.

When AI tools need a database, they often suggest Supabase. It's a solid default choice.

Firebase (Firestore)

Google's database service. It is NoSQL, easy to start with, and common in mobile-heavy projects.

SQLite

A lightweight database that runs directly in your app without a separate server. Great for small prototypes and local development.

How Your App Talks to a Database

When your app needs data, here's the typical flow:

  1. User takes an action — clicks "Save," loads a page, submits a form
  2. Frontend sends a request — to your backend (remember the frontend/backend split?)
  3. Backend queries the database — "Give me all tasks for user 123" or "Save this new task"
  4. Database responds — returns the requested data or confirms the save
  5. Backend sends the response — to the frontend
  6. Frontend displays the result — shows the data to the user

AI tools can wire this flow for you. Understanding it matters because database bugs are easier to debug when you know which step failed.

The Concept of CRUD

Almost every database interaction falls into four categories, nicknamed CRUD:

  • Create — Adding new data (signing up, creating a post, placing an order)
  • Read — Retrieving existing data (loading your profile, viewing a list, searching)
  • Update — Modifying existing data (editing a post, changing your password, updating settings)
  • Delete — Removing data (deleting an account, removing an item, canceling an order)

When you plan features, think about which CRUD operations they actually need. "Users can manage recipes" means create, read, update, and delete recipes.

Try this now

  • Write down the core records your app needs to remember permanently: users, tasks, products, subscriptions, messages, or something else.
  • For each one, note the minimum CRUD operations it needs.
  • Decide whether your project really needs a database yet or whether local state is still enough for the current scope.
  • If it does need one, default to PostgreSQL unless you have a concrete reason not to.

Prompt to give your agent

"Help me design the smallest safe database model for this feature.

  1. List the tables or collections I actually need
  2. Show the key fields and relationships
  3. Explain whether SQL or NoSQL makes more sense here and why
  4. Call out ownership, validation, and deletion risks
  5. Stop before running migrations, destructive schema changes, or data backfills without my approval

Optimize for clear data modeling and easy future maintenance."

What you must review yourself

  • Whether the schema reflects the real business rules instead of just today's UI
  • Whether user ownership and permissions are enforced at the data layer
  • Whether delete behavior, history, and recovery have been considered before data is removed
  • Whether the agent is adding complexity the product does not need yet

Common mistakes to avoid

  • Keeping important data only in client memory. That is how products forget everything on refresh.
  • Overengineering the schema too early. Start with the smallest truthful model, not a fantasy enterprise design.
  • Letting the agent run schema changes casually. Database mistakes are more expensive than UI mistakes.
  • Ignoring data ownership and constraints. A database is not just storage; it is where your product rules become enforceable.

Key takeaways

  • Databases are the durable memory for any app that needs to remember users, content, or activity
  • SQL, especially PostgreSQL, is the safest default for most vibe coding projects
  • Database decisions deserve slower, more explicit review because they shape security, correctness, and future flexibility

What's Next

You now understand the core building blocks of how software works — frontend, backend, servers, APIs, and databases. In the next module, we'll learn the language of software. Not how to write code, but how to recognize and understand the programming languages you'll encounter as a vibe coder. First up: a tour of programming languages and why there are so many of them.