Skip to main content
Agility is built on Next.js and Supabase, making it easy to deploy to various platforms. This guide covers deployment options and best practices.

Architecture Overview

Agility consists of two main components:
  1. Next.js Frontend Application - The web interface and client-side logic
  2. Supabase Backend - Database, authentication, and edge functions

Deployment Options

The recommended deployment stack combines:
  • Vercel for hosting the Next.js application
  • Supabase for backend services (database, auth, edge functions)
This setup provides:
  • Zero-config deployment for Next.js
  • Automatic HTTPS and CDN
  • Serverless edge functions
  • Built-in authentication
  • PostgreSQL database

Alternative Platforms

While Vercel is recommended, you can deploy the Next.js application to:
  • Netlify
  • AWS Amplify
  • Self-hosted Node.js server
  • Docker containers
Regardless of frontend hosting, you must use Supabase for the backend as Agility’s edge functions are built specifically for Supabase.

Deployment Checklist

Before deploying to production:
1

Set up Supabase project

Create a Supabase project and configure the database schema.See Supabase Setup for detailed instructions.
2

Configure environment variables

Set up all required environment variables for your deployment platform.See Environment Variables for the complete list.
3

Deploy edge functions

Deploy Supabase edge functions using the Supabase CLI.
supabase functions deploy
4

Deploy frontend application

Deploy the Next.js application to your chosen platform.For Vercel:
vercel --prod
5

Configure OAuth callbacks

Update OAuth redirect URIs in your Google Cloud Console to match your production domain.
6

Test the deployment

Verify all features work correctly:
  • User authentication
  • Workflow creation and execution
  • Agent configurations
  • Service integrations (Gmail, GitHub, Discord)

Deploying to Vercel

Vercel provides the simplest deployment experience for Next.js applications.

Using Vercel CLI

1

Install Vercel CLI

npm install -g vercel
2

Login to Vercel

vercel login
3

Deploy

From your project root:
vercel
For production deployment:
vercel --prod

Using Vercel Dashboard

1

Connect repository

  1. Go to vercel.com
  2. Click “Add New Project”
  3. Import your Git repository
2

Configure build settings

Vercel automatically detects Next.js projects. Verify:
  • Framework Preset: Next.js
  • Build Command: next build
  • Output Directory: .next
3

Add environment variables

Add all required environment variables in the project settings.
4

Deploy

Click “Deploy” to start the deployment process.

Security Considerations

Environment Variables

Never commit .env.local or any file containing secrets to version control.
  • Use platform-specific secret management (Vercel Environment Variables, AWS Secrets Manager, etc.)
  • Rotate API keys and tokens regularly
  • Use different credentials for development and production

Encryption Key

Agility uses an encryption key to protect sensitive data like API keys and OAuth tokens:
  • Set a strong, random encryption key in production
  • Never use the default encryption key (default-encryption-key)
  • Use the same encryption key across frontend and backend
  • Store the encryption key securely (never in version control)
# Generate a secure encryption key
openssl rand -base64 32

Database Security

  • Enable Row Level Security (RLS) in Supabase
  • Use Supabase’s built-in authentication
  • Regularly backup your database
  • Monitor database access logs

Performance Optimization

Frontend Optimization

  • Enable Next.js production optimizations (automatic in build)
  • Use Vercel’s Edge Network for global distribution
  • Implement proper caching strategies
  • Optimize images using Next.js Image component

Backend Optimization

  • Use Supabase connection pooling
  • Implement proper database indexes
  • Monitor edge function performance
  • Use Supabase’s built-in caching

Monitoring and Logging

Application Monitoring

  • Use Vercel Analytics for frontend performance
  • Monitor Supabase edge function logs
  • Set up error tracking (Sentry, LogRocket, etc.)
  • Monitor API rate limits and usage

Database Monitoring

  • Use Supabase Dashboard for database metrics
  • Monitor query performance
  • Track connection pool usage
  • Set up alerts for critical issues

Troubleshooting

Common Deployment Issues

Build Failures
  • Verify all dependencies are in package.json
  • Check Node.js version compatibility (18+)
  • Review build logs for specific errors
Environment Variable Issues
  • Ensure all required variables are set
  • Verify variable names match exactly (case-sensitive)
  • Check for typos in variable values
Edge Function Errors
  • Review Supabase function logs
  • Verify function deployment was successful
  • Check CORS configuration
  • Ensure encryption keys match
Authentication Issues
  • Verify Supabase URL and anon key are correct
  • Check OAuth redirect URIs match production domain
  • Ensure middleware is configured correctly

Next Steps

Build docs developers (and LLMs) love