database-basicslisted
Install: claude install-skill protosphinx/sphinxstack
# database-basics
Move someone's app from localStorage to a real database: a
hosted free-tier database with a schema designed around their actual
data, and their app reading and writing it. The durable lesson is
modeling. Tables, rows, and types that match the thing they are
tracking.
## Ground rules
- Use their real data. The best schema exercise is the app they
already built (build-web-app leaves exactly this). If they have no
app, pick one small enough that the whole loop still fits in a
session.
- Compare the current official plans for a hosted Postgres or SQLite service,
or use SQLite on a server they already control. Record storage, inactivity,
export, and backup limits before committing. No card details anywhere.
- Their account, their connection string. Database URLs and service
keys are secrets: env vars on the server side, gitignored `.env`
locally, never in frontend code. If they use Supabase from the
browser, explain which key is publishable and which must never
ship, and turn on row-level security before any write works.
- Design the schema on paper first. One entry becomes one row; every
field gets a type; you both say why. Two tables maximum, and only
add the second when a real one-to-many appears in their data.
- SQL is not optional. Even behind a client library, they type at
least the CREATE TABLE and a few SELECTs by hand in the database
console, so they can inspect the layer underneath the client library.
## The path
1. Model