Step 6

Set up your database

What you're about to do

Install your app's dependencies, then run two commands that create your app's database tables inside the Supabase project you just connected — along with the security rules and the “first user becomes the admin” rule.

Why it matters

Your Supabase project is brand new and empty. Supabase handles sign-in on its own, so you'll be able to create an account — but the moment you land on the dashboard, your app tries to read tables that don't exist yet, and it crashes with “Something went wrong.” These commands create those tables, so we do this before the first run.

What you'll need

Step 5 finished — your four Supabase values filled in .env.local (the DATABASE_URL one is what the database commands use). Your terminal open inside your project folder. 5–10 minutes.

Before you start

Run everything on this page from inside your project folder in the terminal. If your terminal opened somewhere else, the next step explains how to cd into your project — the same trick applies here. The database commands read your DATABASE_URL from .env.local, so they only work now that you've filled in your Supabase values (Step 5).

Install the dependencies

First, download all the building blocks your app needs. In the terminal, run:

pnpm install

This takes 2–5 minutes the first time and downloads a few hundred MB of packages — you'll see a wall of text and a progress indicator. When it's done, your command prompt returns. (If you already ran this, it'll finish almost instantly — running it again is harmless.)

Create the tables

Now run:

pnpm db:push

This reads your app's schema and creates all the matching tables in your Supabase database.

It will pause and show you a confirmation prompt listing the changes it's about to make. When it asks, choose “Yes, I want to execute all statements.” (Use the arrow keys to highlight it, then press Enter.)

When it finishes, you'll see a success message and your command prompt will return.

Apply security rules and seed data

Now run the second command:

pnpm db:apply:manual

This one does three things:

  • Applies your row-level security policies — the rules that keep each user's data private.
  • Seeds your plan rows (the free/pro tiers your pricing is built on).
  • Installs the “first user becomes admin” rule — so the very first account you create (in the next step) automatically becomes the owner of your app, with access to /config and /admin.

No confirmation prompt this time — it runs and reports Done. when finished.

Both database commands are safe to run again if you're ever unsure whether they worked — re-running them won't duplicate or break anything.

How to verify it worked

  • pnpm db:push finished after you confirmed “Yes, I want to execute all statements”
  • pnpm db:apply:manual printed Done. with no errors
  • (Optional) In your Supabase dashboard, the Table Editor now shows tables that start with platform_

If the first two are true, your database is ready and you can move on to Step 7.

What to do if something went wrong

Problem: pnpm db:push can't connect / says it can't find the database.

This almost always means DATABASE_URL in .env.local is missing, has a typo, or still contains [YOUR-PASSWORD]. Go back to Step 5 and confirm the connection string is the transaction pooler URI (ending in :6543/postgres) with your real password filled in.

Problem: pnpm: command not found.

Node and pnpm didn't install correctly. Go back to Step 3 and confirm node --version and pnpm --version both show a number.

Problem: I'm not sure if it worked.

Both database commands are safe to re-run. Run them again — if they complete without errors, you're set. You can also open the Table Editor in your Supabase dashboard and look for tables prefixed platform_.

If you're stuck, click Support at the top of this page.