Saving Data
Until now your feature has used local or mock data – close the browser and it's gone. Time to add a real database so data sticks around. We'll use Neon (hosted Postgres), and the best part: Claude sets it up for you through the Vercel Marketplace – you just approve the terms. No separate signups, no local database to run.
Neon is a serverless Postgres database. Provisioning it from the Vercel Marketplace means Claude can create the account and database for you, and Vercel automatically stores the connection details as environment variables across all your environments. It's remote-first – one real database from day one, the way production works.
1. Let Claude provision your database
Because the Vercel plugin is installed, Claude already knows how to add Neon through Vercel. Just ask – you'll only need to approve the terms when prompted.
Claude runs the Vercel integration (vercel integration add neon), Neon spins up a real database, and Vercel injects the connection string (DATABASE_URL) into your project.
Outcome: You have a live Neon Postgres database connected to your project – no manual signup.
2. How environment keys work (important)
That database connection is your first environment variable – a secret value your app needs but that should never be written into your code. Here's the model you'll use for every key from now on:
- Vercel is the source of truth. Your keys live safely in Vercel, set for each environment (development, preview, production). The Neon integration just did this for you.
- Your local copy is pulled down, never hand-written. Claude runs
vercel env pull .env.localto copy the dev keys to your machine..env.localstays out of Git, so secrets never get committed. - This is why a site can work locally but break live: if a key is missing or different on Vercel, the deployed app can't reach the service. (Remember that note from the Debugging lesson – this is the topic it pointed to.)
Never paste a secret into a file or your code by hand. Keys go into Vercel; your local .env.local is only ever pulled from there. When in doubt, ask Claude to re-pull your environment variables.
Outcome: You understand where keys live and how they reach your app safely.
3. Design and create your tables
Now model the data your feature needs and let Claude create the tables in Neon. Keep it to exactly what this feature needs.
Schema changes can be risky (dropping a column loses data). Have Claude explain the impact and confirm with you before applying anything destructive – adding tables or columns is safe; removing or changing them needs a closer look. Claude tracks each change as a migration in your repo so it's repeatable and reversible.
Outcome: Your feature's tables exist in Neon, created through versioned migrations.
4. Connect your feature to the database
Wire your feature to read and write real data – on the server, where your database connection stays private.
Outcome: Your feature stores and loads real data from Neon, and it survives a refresh.
5. Ship it
Your database is already live, and your keys are already on Vercel – so shipping is the same loop as always.
Outcome: Your data-backed feature is live in production.
6. Changing your data later
When you need to add or change tables down the line, just describe it. Claude designs the change, explains the impact, confirms before anything destructive, applies it as a tracked migration, and ships it – the same simple flow you just used.
Outcome: You know how to evolve your database safely as your app grows.