Skip to main content
This guide covers deploying the Bookmarks application to production using popular hosting platforms. The application is built with Vite and React, making it compatible with most static hosting services.

Prerequisites

1

Complete Supabase Setup

Ensure your Supabase project is fully configured:
  • Database schema created
  • Authentication providers enabled
  • Edge Functions deployed
See the Supabase Setup Guide for details.
2

Prepare Environment Variables

Have all required environment variables ready:
  • VITE_SUPABASE_URL
  • VITE_SUPABASE_ANON_KEY
  • VITE_SUPABASE_EF_ANON_KEY
  • VITE_SUPABASE_META_URL
  • VITE_SUPABASE_GENERATE_TAGS_URL
See Environment Variables Guide for details.
3

Test Locally

Verify everything works in development:
npm run dev
Test authentication, creating bookmarks, and tag generation.

Build Configuration

The application uses Vite for building. The build configuration is defined in /vite.config.ts:1-8:
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

export default defineConfig({
  plugins: [react()],
  assetsInclude: ['**/*.md']
})

Build Command

npm run build
This command (tsc && vite build from /package.json:8):
  1. Runs TypeScript compiler to check types
  2. Builds optimized production assets to dist/ directory
The build output is a static site in the dist/ directory that can be deployed to any static hosting service.

Deployment Options

Deploy to Vercel

Vercel offers the best developer experience with zero-config deployments.
1

Install Vercel CLI

npm install -g vercel
2

Login to Vercel

vercel login
3

Deploy

From your project directory:
vercel
Follow the prompts:
  • Set up and deploy: Yes
  • Which scope: Select your account
  • Link to existing project: No
  • Project name: bookmarks (or your preferred name)
  • Directory: **./
  • Override settings: No
4

Add Environment Variables

Via Vercel Dashboard:
  1. Go to your project settings
  2. Navigate to Settings > Environment Variables
  3. Add each variable:
VITE_SUPABASE_URL=https://xxxxxxxxxxxxx.supabase.co
VITE_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
VITE_SUPABASE_EF_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
VITE_SUPABASE_META_URL=https://xxxxxxxxxxxxx.supabase.co/functions/v1/get-metadata
VITE_SUPABASE_GENERATE_TAGS_URL=https://xxxxxxxxxxxxx.supabase.co/functions/v1/generate-tags
Or via CLI:
vercel env add VITE_SUPABASE_URL
vercel env add VITE_SUPABASE_ANON_KEY
vercel env add VITE_SUPABASE_EF_ANON_KEY
vercel env add VITE_SUPABASE_META_URL
vercel env add VITE_SUPABASE_GENERATE_TAGS_URL
5

Deploy to Production

vercel --prod
Your application will be deployed to https://your-project.vercel.app

Automatic Deployments

Connect your Git repository for automatic deployments:
  1. Go to vercel.com/new
  2. Import your Git repository
  3. Configure project settings:
    • Framework Preset: Vite
    • Build Command: npm run build
    • Output Directory: dist
  4. Add environment variables
  5. Click Deploy
Every push to your main branch will trigger a new production deployment. Pull requests create preview deployments.

Post-Deployment Configuration

1

Update Supabase Redirect URLs

Add your production domain to Supabase:
  1. Go to Supabase Dashboard > Authentication > URL Configuration
  2. Add your production URL to Redirect URLs:
    https://your-domain.vercel.app
    https://your-domain.netlify.app
    https://yourdomain.com
    
  3. Update Site URL to your production domain
2

Configure OAuth Providers

Update OAuth app redirect URIs:For each OAuth provider (Google, GitHub, etc.):
  1. Go to the provider’s developer console
  2. Add your production callback URL:
    https://your-project.supabase.co/auth/v1/callback
    
3

Test Production Deployment

Verify all features work in production:
  • Test OAuth login with each provider
  • Test magic link email authentication
  • Verify redirect URLs work correctly
  • Add a new bookmark
  • Verify metadata is fetched correctly
  • Test tag generation
  • Test updating and deleting bookmarks
  • Check page load times
  • Verify images load properly
  • Test on mobile devices

Custom Domain Setup

1

Add Domain

  1. Go to Project Settings > Domains
  2. Enter your custom domain
  3. Click Add
2

Configure DNS

Add DNS records at your domain provider:For root domain (example.com):
Type: A
Name: @
Value: 76.76.21.21
For www subdomain:
Type: CNAME
Name: www
Value: cname.vercel-dns.com
3

Verify Domain

Vercel will automatically verify and provision SSL certificates.

Performance Optimization

Most platforms enable gzip/brotli compression by default. Verify in network tab:
  • Response headers should include Content-Encoding: br or gzip
Optimize cache headers for static assets:Vercel: Create vercel.json:
{
  "headers": [
    {
      "source": "/assets/(.*)",
      "headers": [
        {
          "key": "Cache-Control",
          "value": "public, max-age=31536000, immutable"
        }
      ]
    }
  ]
}
Netlify: Create netlify.toml:
[[headers]]
  for = "/assets/*"
  [headers.values]
    Cache-Control = "public, max-age=31536000, immutable"
The application includes Vercel Analytics (@vercel/analytics in /package.json:15).To use it, import in your main app file:
import { Analytics } from '@vercel/analytics/react'

function App() {
  return (
    <>
      {/* Your app */}
      <Analytics />
    </>
  )
}

Monitoring and Debugging

1

Check Build Logs

Review deployment logs for any build errors or warnings.
2

Monitor Supabase

Use Supabase Dashboard to monitor:
  • API request volume
  • Database performance
  • Auth events
  • Edge Function logs
3

Set Up Error Tracking

Consider integrating error tracking:
  • Sentry
  • LogRocket
  • Rollbar

Troubleshooting

Solution:
  • Run npm run build locally to reproduce the error
  • Fix TypeScript errors in your code
  • Ensure all dependencies are installed
Solution:
  • Verify variables are prefixed with VITE_
  • Check that variables are set for the production environment
  • Redeploy after adding variables
Solution:
  • Verify production domain is added to Supabase redirect URLs
  • Check OAuth app configuration includes production callback URL
  • Ensure HTTPS is enabled on your custom domain
Solution:
  • Check browser console for errors
  • Verify all environment variables are set
  • Check that assets are loading (network tab)
  • Review build logs for missing files
Solution:
  • Verify Edge Function URLs in environment variables
  • Check that functions are deployed in Supabase
  • Review Edge Function logs for errors
  • Test function endpoints directly with curl/Postman

Continuous Deployment

Both Vercel and Netlify support automatic deployments from Git:
1

Development Workflow

  1. Create a feature branch
  2. Make changes and commit
  3. Push to GitHub/GitLab
  4. Platform creates a preview deployment
  5. Review changes on preview URL
2

Merge to Production

  1. Open pull request
  2. Review preview deployment
  3. Merge to main branch
  4. Automatic production deployment
Always test on preview deployments before merging to production!

Next Steps

Monitor Performance

Set up analytics and error tracking

Custom Domain

Configure your custom domain and SSL

Optimize Assets

Configure caching and compression

Set Up CI/CD

Automate testing and deployment

Build docs developers (and LLMs) love