Skip to main content

Environment Variables

Complete reference for all environment variables used in Gully Sports.

Core Settings

Application Environment

# Client-side environment (required)
NEXT_PUBLIC_APP_ENVIRONMENT="production" # or "sandbox" for testing

# Server-side environment (automatically set by Node.js/deployment platform)
NODE_ENV="production" # or "development" for local development
Single Environment Variable Strategy

This application uses a two-variable environment strategy:

Client-Side (Browser/Frontend):

  • NEXT_PUBLIC_APP_ENVIRONMENT controls client-side payment SDKs and APIs
  • Used for: Payment SDK URLs, QuickBooks API endpoints, external API calls

Server-Side (Node.js/Backend):

  • NEXT_PUBLIC_APP_ENVIRONMENT controls server-side payment processing and database connections
  • Used for: Square Payment API, server configurations, security settings
  • Automatically set by deployment platforms (Vercel, AWS, etc.)

Both should be set to "production" for live deployments to ensure:

  • ✅ Live payments processing (PayPal, Venmo, Square, etc.)
  • ✅ Production payment SDKs and APIs
  • ✅ Correct security configurations
  • ✅ Proper database connection pooling

Required Variables

Database (CockroachDB)

DATABASE_URL="postgresql://user:pass@host:port/database?sslmode=require"
DIRECT_URL="postgresql://user:pass@host:port/database?sslmode=require"

Authentication (Supabase)

NEXT_PUBLIC_SUPABASE_URL="https://your-project.supabase.co"
NEXT_PUBLIC_SUPABASE_ANON_KEY="your-anon-key"
SUPABASE_SERVICE_ROLE_KEY="your-service-role-key"

Admin Access

ADMIN_USER_IDS="comma,separated,user,ids"

Optional Variables

Business Information

NEXT_PUBLIC_BUSINESS_NAME="Your Business Name"
NEXT_PUBLIC_CONTACT_EMAIL="contact@yourbusiness.com"
NEXT_PUBLIC_CONTACT_PHONE="+1 (555) 123-4567"
NEXT_PUBLIC_BUSINESS_LOCATION="City, State"
NEXT_PUBLIC_SITE_URL="https://yourdomain.com"

Feature Flags

# Enable/disable lane rental functionality
NEXT_PUBLIC_ENABLE_LANE_RENTAL=true

# Select payment provider (intuit or square)
NEXT_PUBLIC_PAYMENT_PROVIDER=intuit

# Enable/disable PayPal (Intuit only)
# Defaults to false if not set
NEXT_PUBLIC_ENABLE_PAYPAL=true

# Enable/disable Venmo (Intuit only)
# Defaults to false if not set
NEXT_PUBLIC_ENABLE_VENMO=true
PayPal/Venmo Feature Flags

The NEXT_PUBLIC_ENABLE_PAYPAL and NEXT_PUBLIC_ENABLE_VENMO flags only apply when using Intuit as the payment provider. They allow you to:

  • Enable/disable PayPal and Venmo independently
  • Disable specific payment methods while troubleshooting integration issues
  • Gradually roll out PayPal or Venmo support separately
  • Test different payment method combinations
  • Offer different payment options in different environments

Examples:

  • Both ENABLED: Card, Bank, Apple Pay, PayPal, Venmo
  • Only PayPal ENABLED: Card, Bank, Apple Pay, PayPal
  • Only Venmo ENABLED: Card, Bank, Apple Pay, Venmo
  • Both DISABLED: Card, Bank, Apple Pay only

Payment Provider - Intuit

# Required for Intuit payments
NEXT_PUBLIC_INTUIT_SDK_TOKEN="your-sdk-token"
NEXT_PUBLIC_INTUIT_COMPANY_ID="your-company-id"
INTUIT_CLIENT_ID="your-client-id"
INTUIT_CLIENT_SECRET="your-client-secret"
INTUIT_REDIRECT_URI="http://localhost:3000/api/admin/intuit/callback"

# Required for token encryption and storage
INTUIT_ENCRYPTION_KEY="your-32-character-key"

# OAuth tokens (managed automatically after OAuth flow completion)
INTUIT_ACCESS_TOKEN="encrypted-access-token"
INTUIT_REFRESH_TOKEN="encrypted-refresh-token"
Token Encryption

INTUIT_ENCRYPTION_KEY must be exactly 32 characters. The access and refresh tokens are encrypted using this key before being stored.

Sales Tax Calculation

With Intuit OAuth configured, the application automatically uses QuickBooks API for accurate California sales tax calculation based on customer shipping addresses.

Payment Provider - Square

NEXT_PUBLIC_SQUARE_APPLICATION_ID="your-app-id"
NEXT_PUBLIC_SQUARE_LOCATION_ID="your-location-id"
SQUARE_ACCESS_TOKEN="your-access-token"

Image Storage

BLOB_READ_WRITE_TOKEN="your-vercel-blob-token"

Email Service (ZeptoMail)

# Required for transactional emails (order confirmations, subscriptions)
ZEPTOMAIL_API_KEY="your-zeptomail-api-key"
ZEPTOMAIL_FROM_EMAIL="noreply@yourdomain.com"
ZEPTOMAIL_FROM_NAME="Your Business Name"

Email Subscriptions

# Secret key for generating unsubscribe tokens
UNSUBSCRIBE_TOKEN_SECRET="your-secret-key-min-32-chars"

Security Best Practices

  • Never commit .env.local to version control
  • Use different credentials for dev/prod
  • Rotate sensitive keys periodically
  • Use strong, unique passwords

For detailed setup instructions, see: