Skip to main content

Environment Variables

Create a .env file in the root directory with the following variables:

# Server
PORT=9000
NODE_ENV=development
BASE_URL=http://localhost:9000
FRONTEND_URL=http://localhost:3000

# CORS
ALLOWED_ORIGINS=https://your-frontend-url

# Database (PostgreSQL)
DB_NAME=your_database_name
DB_USER=your_database_user
DB_PASSWORD=your_database_password
DB_HOST=localhost
DB_PORT=5432
DB_DIALECT=postgres

# JWT
JWT_SECRET=your_jwt_secret_key

# Email (Resend)
RESEND_API_KEY=re_xxxxxxxxxxxx

# Paystack
PAYSTACK_SECRET_KEY=sk_test_xxxxxxxxxxxx
PAYSTACK_PUBLIC_KEY=pk_test_xxxxxxxxxxxx

# Stellar
STELLAR_NETWORK=https://horizon-testnet.stellar.org
ISSUING_ACCOUNT_SECRET=your_issuing_account_secret
DISTRIBUTION_ACCOUNT_SECRET=your_distribution_account_secret

Variable Reference

VariableDescription
PORTPort the server runs on. Defaults to 9000
NODE_ENVSet to production on deployment
BASE_URLFull URL of the backend server. Used for Paystack callback
FRONTEND_URLURL of the frontend app. Used in password reset emails
ALLOWED_ORIGINSComma-separated list of allowed frontend URLs for CORS
DB_NAMEPostgreSQL database name
DB_USERPostgreSQL username
DB_PASSWORDPostgreSQL password
DB_HOSTDatabase host
DB_PORTDatabase port. Defaults to 5432
DB_DIALECTMust be postgres
JWT_SECRETSecret key for signing JWT tokens. Use a long random string
RESEND_API_KEYAPI key from your Resend dashboard. Go to API Keys and create a new key. Make sure your sending domain is verified before use
PAYSTACK_SECRET_KEYPaystack secret key. Use test key (sk_test_...) for development
PAYSTACK_PUBLIC_KEYPaystack public key
STELLAR_NETWORKUse https://horizon-testnet.stellar.org for development
ISSUING_ACCOUNT_SECRETSecret key of your Stellar issuing account
DISTRIBUTION_ACCOUNT_SECRETSecret key of your Stellar distribution account