Supabase
According to their official website (opens in a new tab), Supabase is an open source Firebase alternative for building secure and performant Postgres backends with minimal configuration.
Checkout official Supabase + Drizzle (opens in a new tab) docs.
Install dependencies
npm i drizzle-orm postgres
npm i -D drizzle-kit
Create your models
schema.ts
import { pgTable, serial, text, varchar } from "drizzle-orm/pg-core";
export const users = pgTable('users', {
id: serial('id').primaryKey(),
fullName: text('full_name'),
phone: varchar('phone', { length: 256 }),
});
Make your first query
index.ts
import { drizzle } from 'drizzle-orm/postgres-js'
import postgres from 'postgres'
import { users } from './schema'
const connectionString = process.env.DATABASE_URL
const client = postgres(connectionString)
const db = drizzle(client);
const allUsers = await db.select().from(users);
Connect to your database using the Connection Pooler for serverless environments, and the Direct Connection for long-running servers.