Environment Configuration

Configure your local environment variables, ports, and AWS settings

1. Root .env.local File

Create a .env.local file in the root of the monorepo with the following configuration:

# Database Configuration
DATABASE_URL="postgres://postgres:password@localhost:5432/zooly2_local?sslmode=disable"

# AWS Configuration
AWS_ACCESS_KEY_ID=your-aws-access-key-id
AWS_SECRET_ACCESS_KEY=your-aws-secret-access-key
DYNAMODB_TABLE_IDENTITIES=zooly-auth-identities
AWS_REGION=us-east-1

# Cognito Configuration
COGNITO_USER_POOL_ID=your-cognito-user-pool-id
COGNITO_CLIENT_ID=your-cognito-client-id
COGNITO_REGION=us-east-1
COGNITO_DOMAIN=zooly-auth

# Cookie Configuration
# Use "localhost" for local development, ".zooly.ai" for production
COOKIE_DOMAIN=localhost

# Google OAuth (for Cognito integration)
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret

# Next.js client-accessible environment variables
NEXT_PUBLIC_AUTH_URL=http://localhost:3003
NEXT_PUBLIC_APP_URL=http://localhost:3004

# CORS Configuration
ALLOWED_DOMAINS_CORS="http://localhost:3004"

2. App-Specific Environment Files

Each app has its own environment file for app-specific configuration:

Auth App (apps/zooly-auth/.env.local)

The auth app uses .env.local and typically contains the same configuration as the root .env.local file:

# Database Configuration
DATABASE_URL="postgres://postgres:password@localhost:5432/zooly2_local?sslmode=disable"

# AWS Configuration
AWS_ACCESS_KEY_ID=your-aws-access-key-id
AWS_SECRET_ACCESS_KEY=your-aws-secret-access-key
DYNAMODB_TABLE_IDENTITIES=zooly-auth-identities
AWS_REGION=us-east-1

# Cognito Configuration
COGNITO_USER_POOL_ID=your-cognito-user-pool-id
COGNITO_CLIENT_ID=your-cognito-client-id
COGNITO_REGION=us-east-1
COGNITO_DOMAIN=zooly-auth

# Cookie Configuration
COOKIE_DOMAIN=localhost

# Google OAuth (for Cognito integration)
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret

# Next.js client-accessible environment variables
NEXT_PUBLIC_AUTH_URL=http://localhost:3003
NEXT_PUBLIC_APP_URL=http://localhost:3004

# CORS Configuration
ALLOWED_DOMAINS_CORS="http://localhost:3004"

Docs App (apps/zooly-docs/.env.local)

The docs app uses .env for Next.js public environment variables:

NEXT_PUBLIC_DOCS_URL=http://localhost:3006
NEXT_PUBLIC_APP_URL=http://localhost:3004

Website App (apps/zooly-website/.env.local)

# Where CTAs open and where journey events are sent
NEXT_PUBLIC_APP_URL=http://localhost:3004
NEXT_PUBLIC_AUTH_URL=http://localhost:3003

# Old zooly deployment that still serves PhotoBomb events, backstage rooms,
# the contact API, and the FAQ / legal page text
LEGACY_ZOOLY_URL=https://zooly.ai

# Optional labels for journey events and Google Analytics
NEXT_PUBLIC_JOURNEY_ENVIRONMENT=local
NEXT_PUBLIC_GOOGLE_ANALYTICS=

# Session recording. Same public project token as the app. Leave blank to record nothing.
NEXT_PUBLIC_POSTHOG_PROJECT_KEY=
NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com

3. Port Configuration

The following ports are recommended for local development:

ApplicationDomainLocal PortCommand
Auth Appauth.zooly.ai3003npm run dev (in apps/zooly-auth)
Main Appapp.zooly.ai3004npm run dev (in apps/zooly-app)
Website Appzooly.ai3005npm run dev (in apps/zooly-website)
Docs Appdocs.zooly.ai3006npm run dev (in apps/zooly-docs)

4. DB setup

See Database Setup for details.