Using Supabase

If you are using Supabase as your database, you can skip this section.

See the official Supabase Javascript SDK docs for more details.

Example of using the Supabase SDK in a server endpoint:

export const GET = (async ({ request, locals }) => {
	const session = await locals.getSession();
	if (!session) {
		throw new Error('Unauthorized');

	// With Supabase SDK
	const user = await locals.supabase

	return new Response(JSON.stringify(user));
}) satisfies RequestHandler;

I am working to see if we can use Drizzle ORM and Drizzle Kit with Supabase (especially usefull for db migrations and typesafety). But since Drizzle is still pre 1.0, usage is limited.

Using Auth.js with Drizzle ORM

Launch Leopard comes with DrizzleORM, a lightweight and blazing fast Typescript ORM. It supports Postgres, MySQL and SQLite databases.

Check their docs for more details on how to use it.

By default, Drizzle is setup with a Postgres database. The database schema is found in src/lib/server/database/schema.ts.

Also see the drizzle.config.ts for the drizzle configuration.

Updating the database schema


Make changes to your schema

Just make changes to your schema in src/lib/server/database/schema.ts.


Generate migration files

Generate the migration files with

npm run db:generate

Migration files are located in drizzle/


Run migration

Then migrate them to create the tables in your database:

npm run db:migrate

The migration script is also run when building your app in production with npm run build.

Using other database providers

Drizzle can also be setup with a MySQL or SQLite database.

Make the changes in drizzle.config.ts, src/lib/server/database/drizzle.ts, src/lib/server/database/schema.ts and src/lib/server/database/migrate.ts files. Check the Drizzle docs for more details.