Environment Setup

Production deployments require a complete set of environment variables and a MongoDB instance.

Required Variables

Variable

Description

MONGODB_URI

MongoDB connection string (local or Atlas)

MONGODB_DATABASE

Database name (optional override)

NEXTAUTH_SECRET

32+ character secret for signing JWTs

NEXTAUTH_URL

Base URL for authentication callbacks

Optional Variables

Variable

Description

EMAIL_WEBHOOK_URL

Webhook for sending password reset emails

LOG_LEVEL

Log verbosity (debug, info, warn, error)

Database Initialization

Initialize the MongoDB collections and indexes before going live:

npx tsx scripts/init-database.ts

If you need to create additional indexes later, run:

npx tsx scripts/create-indexes.ts