Production deployment to Turso DB and Vercel/Railway/Netlify platform
Install the Turso CLI tool to manage your database.
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/tursodatabase/turso/releases/latest/download/turso_cli-installer.sh | sh
Authenticate with your Turso account.
turso auth login
Create a new database instance.
turso db create drizzle-turso-db
Get your database URL and add it to .env.local.
turso db show drizzle-turso-db
DATABASE_URL=
π‘ Note: Copy the URL and add it to your .env file
Generate an authentication token for your database.
turso db tokens create drizzle-turso-db
DATABASE_AUTH_TOKEN=
π‘ Note: Copy the token and add it to your .env file
Apply the following to drizzle.config.ts:
dialect: "turso",
dbCredentials: {
url: process.env.DATABASE_URL!,
authToken: process.env.DATABASE_AUTH_TOKEN!,
},
Generate and run database migrations.
bun db:generate
bun db:migrate
Login to Turso DB and do a quick verification on the Turso Dashboard
Install Nitro.
bun install nitro
Add nitro() to vite.config.ts:
import { nitro } from 'nitro/vite' // β add this
plugins: [
tanstackStart(),
nitro(), // β add this
]
Install Netlify Vite plugin.
bun install -D @netlify/vite-plugin-tanstack-start
Add netlify() to vite.config.ts:
import netlify from '@netlify/vite-plugin-tanstack-start' // β add this
plugins: [
tanstackStart(),
netlify(), // β add this
]