Required variables
These variables are validated at startup and will prevent the server from starting if missing.Secret key for signing JWT access tokens. Must be at least 32 characters long.
Secret key for signing JWT refresh tokens. Must be at least 32 characters long and different from
JWT_SECRET.MongoDB connection string. Supports both standard and SRV formats.
URL where your frontend is hosted. Used for CORS configuration and email links.
Optional core variables
Port number for the HTTP server.
Runtime environment. Set to
production to enable production optimizations:- Serves frontend static files from
frontend/dist - Uses combined logging format
- Enables stricter security headers
Alternative URL for your application. Used as fallback for CORS and payment UPI links.
Database name to use if not specified in
MONGODB_URI.Alternative to
MONGODB_URI. If both are set, MONGODB_URI takes precedence.JWT token expiration
Email configuration (SMTP)
Email features are optional. If SMTP variables are incomplete, the server will start but skip email functionality (registration verification, password reset).SMTP server hostname.
SMTP server port. Common values:
587- STARTTLS (recommended)465- SSL/TLS25- Unencrypted (not recommended)
SMTP authentication username.
SMTP authentication password or API key.
Email address used in the “From” field. Falls back to
SMTP_USER if not set.Order management
These variables control order lifecycle timeouts and no-show restrictions.Secret for signing checkout tokens. Falls back to
JWT_SECRET if not set.Minutes before unpaid orders are automatically cancelled.
Minutes before a ready order is marked as no-show if not picked up.
Minutes for vendors to accept or reject orders before automatic cancellation.
Number of no-shows before warning the user.
Number of no-shows before temporarily restricting ordering.
Days to restrict ordering after hitting the no-show threshold.
Payment
Merchant UPI ID for generating UPI payment links.
File uploads
Directory for storing uploaded files (menu images, store logos). The application automatically:
- Checks if
/dataexists (Fly.io volume mount) - Uses
/data/uploadsif available - Falls back to
backend/public/uploads
Fly.io specific
Automatically set by Fly.io. Used to construct the default CORS origin
https://{FLY_APP_NAME}.fly.dev.Database type
Database type identifier. CampusBite only supports MongoDB. Setting this to any other value will log a warning but not prevent startup.
Development setup
For local development, create a.env file in the backend/ directory:
backend/.env