supabase

use supabase and drizzle-kit to manage database schema and migrations

workflow

use local-first approach to develop and test supabase:

google auth

row level security

commands

Terminal window
supabase init
supabase start
supabase login
supabase stop
supabase export
supabase import

login

login to supabase from local machine and allow to use supabase CLI

Terminal window
npx supabase login

create migration

Terminal window
supabase migrate create -n <migration_name>

supabase and drizzle-kit

https://orm.drizzle.team/learn/tutorials/drizzle-with-supabase

drizzle.config.ts
import { config } from 'dotenv';
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
config({ path: '.env' });
const client = postgres(process.env.DATABASE_URL!);
export const db = drizzle(client);

drizzle-kit

schema.ts is the source of truth for the database schema. It is used to generate the migrations and the typescript types.

commands

https://orm.drizzle.team/kit-docs/commands