Skip to main content
The Vercel AI Chatbot is designed to be deployed on Vercel, but can also be deployed to other platforms that support Next.js applications.

Deployment options

You have several options for deploying your chatbot: The easiest and recommended way to deploy is using Vercel. The application is optimized for Vercel’s infrastructure and includes automatic configuration for:
  • AI Gateway with OIDC authentication
  • Vercel Postgres database
  • Vercel Blob storage
  • Vercel KV (Redis)
  • Environment variable management
See the Vercel deployment guide for detailed instructions.

Other platforms

You can deploy to any platform that supports Next.js 16+ applications, including:
  • Self-hosted Node.js servers
  • Docker containers
  • Other cloud providers (AWS, Google Cloud, Azure)
For non-Vercel deployments, you’ll need to:
  • Manually configure environment variables
  • Set up your own PostgreSQL database
  • Provide an AI Gateway API key
  • Configure file storage (Vercel Blob alternative)
  • Set up Redis for rate limiting

Prerequisites

Before deploying, ensure you have:
1

Node.js 18.17 or later

The application requires Node.js 18.17 or later to run.
2

PostgreSQL database

A PostgreSQL database instance for storing user data, chats, and messages. Vercel Postgres is recommended.
3

Redis instance

Redis is used for rate limiting and caching. Vercel KV is recommended.
4

Blob storage

Storage for file uploads and attachments. Vercel Blob is recommended.
5

AI Gateway access

Access to Vercel AI Gateway for LLM requests. On Vercel, this uses OIDC tokens automatically. For non-Vercel deployments, you’ll need an API key.

Build process

The application uses the following build command:
tsx lib/db/migrate && next build
This command:
  1. Runs database migrations automatically before building
  2. Builds the Next.js application with optimizations
  3. Generates production-ready static and server files
Database migrations run automatically during the build process, so you don’t need to run them separately in most cases.

Runtime requirements

Node.js runtime

The application requires a Node.js runtime environment. It uses:
  • Next.js 16.0.10
  • React 19.0.1
  • Server-side rendering and API routes

Environment variables

All required environment variables must be set before deployment. See the environment variables guide for a complete list.

Database migrations

Database migrations are handled by Drizzle ORM and run automatically during the build process. The migration script:
  • Checks if POSTGRES_URL is defined
  • Skips migrations gracefully if no database is configured (for preview deployments)
  • Applies all pending migrations from lib/db/migrations/
  • Reports success or failure

Security considerations

Never commit your .env.local file or expose secrets in your codebase. Use environment variable management tools provided by your deployment platform.

Required secrets

  • AUTH_SECRET - Used for session encryption (generate with openssl rand -base64 32)
  • POSTGRES_URL - Database connection string (should not be exposed)
  • BLOB_READ_WRITE_TOKEN - Storage access token
  • REDIS_URL - Redis connection string
  • AI_GATEWAY_API_KEY - Required for non-Vercel deployments

Authentication

The application uses NextAuth.js for authentication with:
  • Credentials provider for email/password authentication
  • Guest user support
  • Secure password hashing with bcrypt
  • Session management

Next steps

Environment variables

Complete guide to all required and optional environment variables

Database setup

Configure PostgreSQL and run migrations with Drizzle ORM

Deploy to Vercel

Step-by-step guide for deploying to Vercel

Build docs developers (and LLMs) love