GatePass uses environment variables to configure payment gateways, blockchain networks, and third-party services. This guide documents all available variables.
Configuration Files
GatePass uses different environment files for different parts of the application:Root .env
Frontend configuration (Vite)Variables prefixed with
VITE_Server .env
Backend configuration (Express)Standard environment variables
Frontend Variables (Root .env)
These variables are used by the React/Vite frontend application and must be prefixed withVITE_ to be exposed to the client.
Payment Gateway Configuration
Paystack public API key for accepting card payments in Nigeria and Ghana.Format:
pk_test_... (test) or pk_live_... (production)Example:Flutterwave public API key for accepting payments across Africa.Format:
FLWPUBK_TEST-... (test) or FLWPUBK-... (production)Example:Blockchain Configuration
The blockchain network ID for NFT ticketing.Common values:
1- Ethereum Mainnet137- Polygon Mainnet80001- Polygon Mumbai Testnet11155111- Ethereum Sepolia Testnet
The RPC endpoint URL for blockchain interactions.Example:
Analytics
Analytics service identifier (Google Analytics, Mixpanel, etc.).Example:
Backend Variables (Server .env)
The backend
.env file should be located at src/packages/server/.env (if needed). Currently, the application uses the Supabase configuration wired in the codebase.Database
PostgreSQL connection string for production. SQLite is used by default in development.Format: The database URL is read by Prisma from this variable in
postgresql://USER:PASSWORD@HOST:PORT/DATABASE?schema=SCHEMAExample:schema.prisma:11.Authentication
Secret key for signing JWT tokens.Example:
JWT token expiration time.Example:
OAuth Configuration
Google OAuth 2.0 client ID for “Sign in with Google”.Example:Get credentials from Google Cloud Console.
Google OAuth 2.0 client secret.Example:
Twitter OAuth 1.0a API key for “Sign in with Twitter”.
Twitter OAuth 1.0a API secret.
Email Service
SMTP server hostname for sending emails.Example:
SMTP server port.
SMTP authentication username.
SMTP authentication password.
Sender email address for outgoing emails.Example:
Server Configuration
Port for the Express server.Example:
Node environment mode.Values:
development, production, testExample:Allowed CORS origins (comma-separated).Example:
Example Configuration Files
Development Environment
Production Environment
Variable Precedence
Security Best Practices
Use .env Files
Keep credentials in
.env files that are in .gitignoreRotate Keys
Regularly rotate API keys and secrets
Separate Environments
Use different keys for dev, staging, and production
Strong Secrets
Generate strong random strings for JWT secrets
Generating Secure Secrets
Environment Variable Validation
The application validates required environment variables on startup. If required variables are missing, the server will fail to start with an error message.Troubleshooting
Variables Not Loading
Variables Not Loading
Frontend (Vite):
- Ensure variables are prefixed with
VITE_ - Restart the dev server after changing
.env - Clear cache:
rm -rf node_modules/.vite
- Check the
.envfile location - Verify you’re using
dotenvor similar - Restart the server
Payment Gateway Errors
Payment Gateway Errors
- Verify API keys are for the correct environment (test vs live)
- Check that keys haven’t expired
- Ensure keys have the correct permissions
- Look for typos in variable names
Blockchain Connection Issues
Blockchain Connection Issues
- Verify the RPC URL is accessible
- Check that
VITE_CHAIN_IDmatches the network - Try a different RPC provider
- Ensure you have API credits (Alchemy, Infura)
Next Steps
Local Setup
Set up your development environment
Database Schema
Learn about the data models