> Documentation index: https://docs.mayur.live/llms.txt

# Installing Voiceflow API

Install project dependencies, configure environment variables, and apply database migrations.

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`:

```bash
npm install
```

:::note
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:

```bash
cp .env.example .env
```

2. Fill in all required environment variables:

| Variable | Required | Description |
| --- | --- | --- |
| `NODE_ENV` | No | Environment mode: `development` (default), `production`, or `test` |
| `PORT` | No | Listening port (defaults to `3000`) |
| `DATABASE_URL` | Yes | PostgreSQL connection string. When using Supabase, provide the session pooler URL |
| `BETTER_AUTH_SECRET` | Yes | Secret key of at least 32 characters |
| `BETTER_AUTH_URL` | Yes | Public origin for authentication |
| `CLIENT_URL` | Yes | Frontend application origin used for CORS |
| `RESEND_API_KEY` | Yes | Resend API key for outbound emails |
| `EMAIL_FROM` | Yes | Sender address, e.g., `Voiceflow <hi@your-domain.com>` |
| `S3_ENDPOINT` | No | Custom S3 endpoint URL (omit for AWS S3; required for Supabase, Cloudflare R2, or MinIO) |
| `S3_REGION` | No | S3 region (defaults to `us-east-1`) |
| `S3_BUCKET` | Yes | Target storage bucket name |
| `S3_ACCESS_KEY_ID` | Yes | S3 access key credential |
| `S3_SECRET_ACCESS_KEY` | Yes | S3 secret access key credential |
| `S3_FORCE_PATH_STYLE` | No | Boolean flag (`true` for Supabase or MinIO; defaults to `false`) |
| `SARVAM_API_KEY` | Yes | API key for Sarvam speech transcription |
| `OPENROUTER_API_KEY` | Yes | API key for OpenRouter AI processing |
| `SENTIMENT_MODEL` | No | Model name (defaults to `openai/gpt-4o-mini`) |
| `INNGEST_EVENT_KEY` | No | Inngest event key (required in production) |
| `INNGEST_SIGNING_KEY` | No | Inngest signing key (required in production) |

## Database Migrations

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

```bash
npx prisma migrate deploy
```
