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
This application uses a two-variable environment strategy:
Client-Side (Browser/Frontend):
NEXT_PUBLIC_APP_ENVIRONMENTcontrols 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_ENVIRONMENTcontrols server-side payment processing and database connections- Used for: Square Payment API, server configurations, security settings
- Automatically set by AWS Amplify (and other Node.js deployment platforms)
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 (PostgreSQL)
# Local dev (Docker)
DATABASE_URL="postgresql://postgres:postgres@localhost:54322/gullysports"
DIRECT_URL="postgresql://postgres:postgres@localhost:54322/gullysports"
# Production (Supabase)
# DATABASE_URL="postgresql://postgres.[ref]:[password]@aws-0-us-west-1.pooler.supabase.com:6543/postgres"
# DIRECT_URL="postgresql://postgres.[ref]:[password]@aws-0-us-west-1.pooler.supabase.com:5432/postgres"
Authentication (Supabase — auth only)
NEXT_PUBLIC_SUPABASE_URL="https://your-project.supabase.co"
NEXT_PUBLIC_SUPABASE_ANON_KEY="your-anon-key"
Admin Access
Admin access is granted per-user in the database, not via an env var. Set the role column on a User row to 'ADMIN':
UPDATE "User" SET role = 'ADMIN' WHERE email = 'you@example.com';
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
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"
INTUIT_ENCRYPTION_KEY must be exactly 32 characters. The access and refresh tokens are encrypted using this key before being stored.
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"
Admin Order Notifications
Fired automatically after every successful checkout (Square card, Intuit card, PayPal/Venmo). Both variables are optional — each channel gracefully no-ops when its env var is unset, so leaving one blank is a supported way to disable that channel.
# Email a per-order summary to the admin inbox via Zeptomail (uses ZEPTOMAIL_API_KEY above)
ADMIN_NOTIFICATION_EMAIL="ops@yourdomain.com"
# POST a JSON payload to an n8n flow per order (for Slack relay, sheet logging, etc.)
N8N_WEBHOOK_URL="https://n8n.example.com/webhook/your-id"
To smoke-test the wiring without running a checkout, sign in as an admin and POST /api/admin/test-notification — it sends a synthetic order through the same fan-out and reports which channels were attempted.
Email Subscriptions
# Secret key for generating unsubscribe tokens
UNSUBSCRIBE_TOKEN_SECRET="your-secret-key-min-32-chars"
Security Best Practices
- Never commit
.env.localto version control - Use different credentials for dev/prod
- Rotate sensitive keys periodically
- Use strong, unique passwords
For detailed setup instructions, see: