Deployment

Deploy your matt-init project to production with Vercel and Turso


Vercel Deployment

Vercel is the recommended deployment platform for matt-init projects, as it's the most straightforward way to deploy Next.js applications.

Quick Deploy

  1. Push to GitHub (if not already done)
  2. Connect to Vercel:
    • Visit vercel.com
    • Import your GitHub repository
    • Vercel auto-detects Next.js configuration
  3. Set Environment Variables: It pains me to say this, but please do not use the same environment variables as your local development. Instead, create new environment variables for production. This should include any auth secrets, API keys, etc.
  4. Deploy! Vercel automatically builds and deploys your app.

Custom Domain

# Using Vercel CLI
npm i -g vercel
vercel --prod
vercel domains add yourdomain.com

Advanced Configuration

Create vercel.json for custom settings:

{
  "functions": {
    "app/api/**/*.ts": {
      "maxDuration": 30
    }
  },
  "crons": [
    {
      "path": "/api/cron/cleanup",
      "schedule": "0 2 * * *"
    }
  ]
}

Turso Database Setup

Create Production Database

  1. Create and configure database:
# Create production database
turso db create my-app-prod

# Get database URL
turso db show my-app-prod --url

# Create auth token
turso db tokens create my-app-prod
  1. Run Migrations:
# Set production environment variables
export TURSO_DATABASE_URL="libsql://your-database.turso.io"
export TURSO_AUTH_TOKEN="your-auth-token"

# Run migrations
pnpm db:migrate
  1. Backup Strategy:
# Manual backup
turso db shell my-app-prod ".dump" > backup-$(date +%Y%m%d).sql

# Turso Pro includes automatic backups (if you feel like spending money)

Resources