# What is a database?

> A database is an organized digital filing cabinet where your app remembers information between visits—such as user accounts, saved items, or orders—stored in structured tables on a server so the data stays safe even when visitors close their browser.

## Analogy

Think of a spreadsheet cabinet in the back office: each drawer is a table (`users`, `recipes`), each column is a required field (`email`, `title`, `created_at`), and each row is a single record. Whenever someone saves a recipe, the backend files a new card in the right drawer.

## How it works

Not every app needs a database. A personal portfolio, a calculator, or a unit converter forgets everything when you refresh the page, and that is fine: no data stored means no database needed. You only add a database when your app must remember things across visits or across different people.

Inside a relational database (our stack uses **Postgres** hosted on **Neon**), information lives in **tables**. Each table has **columns** that define what kind of data is allowed (text, number, date, true/false) and **rows** for each saved item, so your app never stores messy or incomplete records.

Your backend connects to Neon using a single secret address stored in the `DATABASE_URL` env-var. When you connect Neon from your vercel project (**Storage → Neon**), Vercel sets `DATABASE_URL` online automatically, and your agent pulls a separate development connection into `.env.local`.

Just as git has branches for code, Neon creates a separate **database branch** for local development and for each preview. That way, when you or your agent test adding or deleting items locally, you never touch real user data in production.

## In your project

During **③ Spec**, your agent asks what your app needs to remember. If nothing needs to be saved, it skips the database completely. If your app does need one, it waits until the plan reaches the database task, guides you click by click to connect Neon in Vercel, and writes safe, parameterized queries so user input can never tamper with your tables.

## Copy for your agent

```text
Based on my SPEC.md, tell me whether my app needs a database. If it does, list the tables and columns we need in plain words and confirm how we keep development data separate from production.
```

---
Source: [Agentic Makers](https://agenticmakers.app/en/learn/what-is-a-database) · License: CC BY 4.0
