Drizzle
Connecting with Drizzle
Drizzle ORM is a TypeScript ORM for SQL databases designed with maximum type safety in mind. You can use their ORM to connect to your database.
If you plan on solely using Drizzle instead of the Supabase Data API (PostgREST), you can turn off the latter in the API Settings.
1
Install
Install Drizzle and related dependencies.
_10npm i drizzle-orm postgres_10npm i -D drizzle-kit
2
Create your models
Create a schema.ts
file and define your models.
3
Connect
Connect to your database using the Connection Pooler.
In your Database Settings
, make sure Use connection pooler
is checked, then copy the URI and save it as the DATABASE_URL
environment variable. Remember to replace the password placeholder with your actual database password.