Skip to main content

Deploy to Vercel

Deploy Umami to Vercel’s serverless platform for automatic scaling and global CDN distribution.

Prerequisites

Important: Vercel deployment requires an external PostgreSQL database. Vercel doesn’t provide a built-in database, so you’ll need to use a service like:
  • Supabase (recommended, free tier available)
  • Neon (serverless PostgreSQL)
  • Railway (PostgreSQL only)
  • AWS RDS
  • Self-hosted PostgreSQL
Vercel is a serverless platform optimized for Next.js applications. It provides:
  • Automatic deployments from Git
  • Global CDN
  • Automatic HTTPS
  • Environment variable management
  • Free tier for hobby projects

Quick Deploy

1

Set Up PostgreSQL Database

Before deploying to Vercel, create a PostgreSQL database:
2

Fork the Repository

Fork Umami to your GitHub account:
  1. Go to github.com/umami-software/umami
  2. Click Fork button
  3. Choose your account
3

Deploy to Vercel

If available, use the Vercel deploy button in the README, or:
  1. Go to vercel.com/new
  2. Import your forked repository
  3. Click Import
4

Configure Environment Variables

Add environment variables in Vercel:
  1. In the import screen, expand Environment Variables
  2. Add the following:
DATABASE_URL=your-postgresql-connection-string
APP_SECRET=your-random-secret-string
Generate a secure random string for APP_SECRET:
openssl rand -base64 32
Make sure to add variables for all environments:
  • Production
  • Preview
  • Development (optional)
5

Deploy

  1. Click Deploy
  2. Vercel will build and deploy Umami
  3. Wait for deployment to complete (2-5 minutes)
  4. Click Visit to open your Umami instance
6

Initialize Database

On first deployment, you need to initialize the database:
7

Access Umami

Your Umami instance is now live at:
https://your-project.vercel.app
Login with default credentials:
  • Username: admin
  • Password: umami
Change the default password immediately!

Custom Domain Setup

Add your own domain to Vercel:
1

Add Domain in Vercel

  1. Go to your project in Vercel
  2. Click Settings tab
  3. Click Domains in sidebar
  4. Enter your domain (e.g., analytics.yourdomain.com)
  5. Click Add
2

Configure DNS

Vercel will show you DNS records to add:
For subdomains like analytics.yourdomain.com:
Type: CNAME
Name: analytics
Value: cname.vercel-dns.com
TTL: 3600
3

Verify Domain

  1. Wait for DNS propagation (5 minutes - 48 hours)
  2. Vercel automatically verifies and provisions SSL
  3. Access your Umami at https://your-domain.com

Environment Variables

Configure Umami on Vercel:
# PostgreSQL connection (required)
DATABASE_URL=postgresql://user:password@host:5432/database

# Encryption secret (required)
APP_SECRET=random-secret-string-here
# Disable Next.js telemetry
NEXT_TELEMETRY_DISABLED=1

# Custom base path
BASE_PATH=/analytics

# Custom tracker script name
TRACKER_SCRIPT_NAME=umami.js,analytics.js

# Force SSL
FORCE_SSL=1

# Allowed frame ancestors (for embedding)
ALLOWED_FRAME_URLS=https://yourdomain.com

# CORS settings
CORS_MAX_AGE=86400

Update Environment Variables

  1. Go to SettingsEnvironment Variables
  2. Click Edit on the variable
  3. Update the value
  4. Click Save
  5. Redeploy for changes to take effect

Database Configuration

Connection Pooling

Vercel serverless functions create many database connections. Use connection pooling to avoid “too many connections” errors.
Use the connection pooling endpoint:
# Instead of direct connection:
# postgresql://postgres:[PASSWORD]@db.xxx.supabase.co:5432/postgres

# Use pooler (port 6543):
DATABASE_URL=postgresql://postgres:[PASSWORD]@db.xxx.supabase.co:6543/postgres?pgbouncer=true

Database Performance

Vercel’s free tier has limitations:
  • 100GB bandwidth/month
  • 100 hours serverless function execution
  • 6,000 serverless function invocations per day
High-traffic sites should upgrade to Pro.

Build Configuration

Build Settings

Vercel auto-detects Next.js projects. Default settings:
# Build Command
pnpm run build

# Output Directory
.next

# Install Command
pnpm install

# Development Command
pnpm dev

Custom Build Settings

Override in vercel.json:
vercel.json
{
  "buildCommand": "pnpm run build",
  "devCommand": "pnpm dev",
  "installCommand": "pnpm install",
  "framework": "nextjs",
  "outputDirectory": ".next"
}

Deployment Settings

Auto-Deploy from Git

Vercel automatically deploys:
  • Production: Pushes to main branch
  • Preview: Pushes to other branches or pull requests
Every pull request gets a unique preview URL for testing changes.

Disable Auto-Deploy

  1. Go to SettingsGit
  2. Toggle Production Branch or Preview Branches
  3. Click Save

Monitoring and Logs

View Logs

  1. Go to your project dashboard
  2. Click on a deployment
  3. View:
    • Build Logs: Compilation output
    • Function Logs: Runtime logs
    • Error Logs: Runtime errors

Real-time Logs

Use Vercel CLI:
vercel logs your-project.vercel.app

# Follow logs in real-time
vercel logs --follow

Analytics

Enable Vercel Analytics:
  1. Go to Analytics tab
  2. Click Enable Analytics
  3. View:
    • Pageviews
    • Top pages
    • Top referrers
    • Device breakdown
Vercel Analytics is separate from Umami. Umami tracks your websites, while Vercel Analytics tracks the Umami dashboard itself.

Troubleshooting

The build process needs DATABASE_URL:
  1. Go to SettingsEnvironment Variables
  2. Ensure DATABASE_URL is set for all environments
  3. Redeploy
If Prisma migration fails:
  • Run migrations manually (see Initialize Database step)
  • Check database connection from your local machine
Enable connection pooling:
  • Use Supabase pooler (port 6543)
  • Use Neon (built-in pooling)
  • Set up PgBouncer
  • Reduce concurrent function executions
Vercel has execution limits:
  • Hobby: 10 seconds
  • Pro: 60 seconds
  • Enterprise: 900 seconds
Solutions:
  • Upgrade to Pro for longer timeouts
  • Optimize slow database queries
  • Use background jobs for long tasks
Check deployment logs:
  1. Click on failed deployment
  2. View build logs for errors
  3. Common issues:
    • Missing environment variables
    • Database connection failed
    • Build errors in code
    • Out of memory
Try:
  • Redeploy
  • Clear build cache: Settings → General → Clear Cache
  • Check Vercel status page
Optimize performance:
  • Use connection pooling
  • Add database indexes
  • Enable Redis caching (if using REDIS_URL)
  • Upgrade to Pro for better resources
  • Use ClickHouse for high-volume analytics

Updating Umami

1

Sync Fork with Upstream

Keep your fork updated:
# Add upstream remote
git remote add upstream https://github.com/umami-software/umami.git

# Fetch updates
git fetch upstream

# Merge updates
git checkout main
git merge upstream/main

# Push to your fork
git push origin main
2

Auto-Deploy

Vercel automatically deploys when you push to main:
  1. Watch deployment progress in Vercel dashboard
  2. Database migrations run automatically
  3. New version is live when deployment completes
3

Verify Update

Check the version:
  1. Login to Umami
  2. Go to Settings
  3. Check version number at bottom

Best Practices

Use Connection Pooling

Prevents “too many connections” errors in serverless environment

Enable Preview Deployments

Test changes in preview URLs before merging to production

Set Up Database Backups

Regularly backup your PostgreSQL database

Monitor Function Usage

Track Vercel usage to avoid hitting free tier limits
For high-traffic sites, consider using Railway or self-hosting instead. Vercel’s serverless model can be expensive at scale.

Cost Optimization

Stay within Vercel’s free tier:
  • Free tier: Unlimited for personal projects with usage limits
  • Pro: $20/month per member (better limits)
  • Enterprise: Custom pricing
Tips:
  • Use efficient database queries
  • Enable caching where possible
  • Monitor function execution time
  • Optimize images and assets
  • Consider upgrading for high-traffic sites

Next Steps

Add Website

Start tracking your first website

Configure Variables

Set up advanced features

Database Optimization

Optimize PostgreSQL performance

Custom Domain

Set up your own domain

Build docs developers (and LLMs) love