Learn how to install dependencies, configure environment settings, and apply database migrations for the Voiceflow API backend.

Prerequisites#

Before setting up the project, make sure your environment includes:

  • Node.js 22 or newer
  • A PostgreSQL database
  • An S3-compatible storage bucket (such as AWS S3, Supabase Storage, Cloudflare R2, or MinIO)
  • Accounts and API keys for Resend, Sarvam, and OpenRouter

Dependency Installation#

  1. Install project dependencies using npm. This command installs required packages and automatically runs prisma generate:
npm install

The postinstall script triggers prisma generate to build the Prisma client whenever dependencies are installed.

Configuring Environment Variables#

Configuration is validated at application startup using zod via env. The service will fail to start if any required variables are missing.

  1. Create a local .env configuration file from the template:
cp .env.example .env
  1. Fill in all required environment variables:
VariableRequiredDescription
NODE_ENVNoEnvironment mode: development (default), production, or test
PORTNoListening port (defaults to 3000)
DATABASE_URLYesPostgreSQL connection string. When using Supabase, provide the session pooler URL
BETTER_AUTH_SECRETYesSecret key of at least 32 characters
BETTER_AUTH_URLYesPublic origin for authentication
CLIENT_URLYesFrontend application origin used for CORS
RESEND_API_KEYYesResend API key for outbound emails
EMAIL_FROMYesSender address, e.g., Voiceflow <hi@your-domain.com>
S3_ENDPOINTNoCustom S3 endpoint URL (omit for AWS S3; required for Supabase, Cloudflare R2, or MinIO)
S3_REGIONNoS3 region (defaults to us-east-1)
S3_BUCKETYesTarget storage bucket name
S3_ACCESS_KEY_IDYesS3 access key credential
S3_SECRET_ACCESS_KEYYesS3 secret access key credential
S3_FORCE_PATH_STYLENoBoolean flag (true for Supabase or MinIO; defaults to false)
SARVAM_API_KEYYesAPI key for Sarvam speech transcription
OPENROUTER_API_KEYYesAPI key for OpenRouter AI processing
SENTIMENT_MODELNoModel name (defaults to openai/gpt-4o-mini)
INNGEST_EVENT_KEYNoInngest event key (required in production)
INNGEST_SIGNING_KEYNoInngest signing key (required in production)

Database Migrations#

Prisma uses DATABASE_URL to connect to your database. Run the following command to apply schema migrations:

npx prisma migrate deploy