🌐 Production Deploy

Documentation
Guide

🌐 Production Deploy

Production deployment to Turso DB and Vercel/Railway/Netlify platform

Documentation
Guide
0 Pages
Available

Turso DB Deployment

1. Install Turso CLI

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

2. Login to Turso

Authenticate with your Turso account.

turso auth login

3. Create new Turso DB

Create a new database instance.

turso db create drizzle-turso-db

4. View and copy Turso URL

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

5. Create and copy auth token

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

6. Turso DB Configuration

Apply the following to drizzle.config.ts:

dialect: "turso",
dbCredentials: {
    url: process.env.DATABASE_URL!,
    authToken: process.env.DATABASE_AUTH_TOKEN!,
  },

7. Turso DB migration

Generate and run database migrations.

bun db:generate
bun db:migrate

8. Turso DB Dashboard

Login to Turso DB and do a quick verification on the Turso Dashboard

Vercel/Railway Deployment

1. Nitro and Vite config

Install Nitro.

bun install nitro

Add nitro() to vite.config.ts:

import { nitro } from 'nitro/vite' // ← add this
plugins: [
  tanstackStart(),
  nitro(), // ← add this
]

2. Push production code to GitHub

3. Deploy production code to Vercel/Railway

  • Login to Vercel/Railway Dashboard
  • Create new project
  • Select to deploy code from github
  • Add all .env vars before or after the first deploy
  • Update BASE_URL and VITE_BASE_URL to correct values and deploy again, DONE!

Netlify Deployment

1. Netlify Vite config

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
]

2. Push production code to GitHub

3. Deploy production code to Netlify

  • Login to Netlify Dashboard
  • Create new project
  • Select to deploy code from github
  • Add all .env vars before or after the first deploy
  • Update BASE_URL and VITE_BASE_URL to correct values and deploy again, DONE!