RefactKit uses Supabase as its managed PostgreSQL provider and Drizzle ORM as the type-safe query layer. You need to create a Supabase project, copy your connection string intoDocumentation Index
Fetch the complete documentation index at: https://docs.refactkit.com/llms.txt
Use this file to discover all available pages before exploring further.
.env.local, and push the schema before the app can start. This page walks you through each step.
Prerequisites
- A Supabase account (free tier is sufficient)
DATABASE_URLis the only variable required to complete database setup
Steps
Create a Supabase project
Go to supabase.com, sign in, and click New Project. Choose an organization, enter a project name, set a strong database password, and select the region closest to your users. Supabase will provision your PostgreSQL instance — this usually takes about a minute.
Get your connection string
- In your project dashboard, go to Project Settings → Database.
- Scroll down to the Connection string section and select the URI tab.
- Click Transaction pooler to switch to the pooled connection (port
6543). - Copy the URI — this is your
DATABASE_URL.
[ref], [password], and [region] with the values from your project.Add the variable to your environment file
Copy
.env.example to .env.local if you haven’t already, then paste your DATABASE_URL:Drizzle reads
DATABASE_URL at both build time (for schema pushes) and runtime (for queries). Make sure the variable is present in both your local .env.local and your hosting environment.Push the schema to Supabase
Run the following command from the project root. Drizzle Kit reads your schema file and applies the table definitions directly to your Supabase database:You will see a list of tables being created (users, sessions, organizations, members, invitations, gallery images, and the Better Auth rate-limit tables). Re-run this command every time you modify
db/schema.ts.drizzle-kit push applies schema changes directly without generating migration files. If you prefer version-controlled migrations, use npx drizzle-kit generate instead, which writes SQL files to the ./drizzle directory.Open Drizzle Studio (optional)
Drizzle Studio is a browser-based visual editor for your database. Start it with:The studio opens at https://local.drizzle.studio. You can browse tables, run queries, and inspect your data without leaving your terminal workflow.
Database commands reference
| Command | Purpose |
|---|---|
npx drizzle-kit push | Sync db/schema.ts changes directly to PostgreSQL |
npx drizzle-kit studio | Open the visual database browser at local.drizzle.studio |
npx drizzle-kit generate | Generate versioned SQL migration files into ./drizzle |
How the connection is configured
The database client indb/index.ts connects via postgres.js with settings tuned for the Supabase transaction pooler:
prepare: false option disables prepared statements, which are not supported by the transaction pooler. Do not remove this option.