Drizzle <> Turso Database Serverless

This guide assumes familiarity with:

According to the official website, Turso is the small database to power your big dreams in the age of AI.

Step 1 - Install packages

npm
yarn
pnpm
bun
npm i drizzle-orm@rc @tursodatabase/serverless
npm i -D drizzle-kit@rc

Step 2 - Initialize the driver and make a query

import { drizzle } from 'drizzle-orm/tursodatabase-serverless';

const db = drizzle({
	connection: {
		url: process.env.TURSO_URL,
		authToken: process.env.TURSO_TOKEN
	}
});

const result = await db.all('select 1');

If you need to provide your existing drivers:

import { connect } from '@tursodatabase/serverless';
import { drizzle } from 'drizzle-orm/tursodatabase-serverless';

const client = connect({
    url: process.env.TURSO_URL,
    authToken: process.env.TURSO_TOKEN
});
const db = drizzle({ client });

const result = await db.all('select 1');

Whatโ€™s next?