Overview
jøsh requires several environment variables to function properly. Create a.env file in the project root and configure the following variables.
Required Variables
Database Configuration
PostgreSQL database connection strings for Prisma.| Variable | Description |
|---|---|
DATABASE_URL | PostgreSQL connection string with connection pooling support |
DIRECT_URL | Direct PostgreSQL connection string (without pooling) for migrations |
When using services like Supabase or Neon,
DATABASE_URL typically uses connection pooling (port 6543), while DIRECT_URL connects directly (port 5432).AI Gateway Configuration
API key for AI service integrations (OpenAI, Mistral).| Variable | Description | Used By |
|---|---|---|
AI_GATEWAY_API_KEY | API key for AI services | Profile structuring, onboarding, scheduling, photo tagging, ID extraction |
src/lib/tpoScheduling.ts:36src/lib/tpoPhotoTags.ts:23src/lib/tpoOnboardingAdlib.ts:24src/lib/tpoAnswerQuality.ts:131src/lib/profileStructuring.ts:346src/lib/onboardingGaps.ts:39src/lib/dlExtract.ts:104
Surge SMS Configuration
Surge API credentials for SMS messaging functionality.| Variable | Description | Required For |
|---|---|---|
SURGE_API_KEY | Surge API authentication key | Sending SMS messages |
SURGE_ACCOUNT_ID | Your Surge account identifier | SMS API requests |
SURGE_WEBHOOK_SECRET | Secret for validating webhook signatures | Webhook security |
The Surge SMS integration is used for the TPO (dating) feature to communicate with users via text message.
src/lib/surgeSend.ts:5src/lib/surgeWebhook.ts:3src/app/api/tpo/webhook/route.ts:78
Supabase Configuration
Supabase credentials for file storage and authentication.| Variable | Description | Default |
|---|---|---|
SUPABASE_PROJECT_URL | Your Supabase project URL | - |
SUPABASE_SERVICE_ROLE_KEY | Supabase service role key (admin access) | - |
SUPABASE_UPLOAD_BUCKET | Bucket name for file uploads | tpo-uploads |
src/app/api/tpo/webhook/route.ts:31src/app/api/tpo/admin/signed-url/route.ts:9
Internal API Authentication
API key for internal service authentication.| Variable | Description |
|---|---|
MUTUAL_INTERNAL_API_KEY | Secret key for authenticating internal API requests |
src/lib/internalApiAuth.ts:4
Optional Variables
Development Environment
| Variable | Description | Values |
|---|---|---|
NODE_ENV | Application environment mode | development, production, test |
Next.js automatically sets
NODE_ENV during build and development. You typically don’t need to set this manually.Webhook Validation (Development)
| Variable | Description | Default |
|---|---|---|
SURGE_SKIP_WEBHOOK_VALIDATION | Skip webhook signature validation (dev only) | false |
Environment-Specific Configuration
Local Development
Example.env file for local development:
Production (Vercel)
For production deployment on Vercel:- Navigate to your project settings
- Go to Environment Variables
- Add all required variables
- Set appropriate values for production environments
Vercel automatically injects environment variables during build and runtime. Use the Vercel dashboard to manage production secrets.
Validation
The application validates required environment variables at runtime. Missing critical variables will throw errors:Security Best Practices
Use different credentials for each environment
Maintain separate API keys and database credentials for development, staging, and production.
Rotate secrets regularly
Periodically update API keys and webhook secrets, especially after team member changes.
Restrict service role keys
Use Supabase RLS (Row Level Security) policies even with service role keys when possible.
Next Steps
Local Setup
Set up your local development environment
Deployment
Deploy jøsh to production