Environment Variables
All configuration variables for frontend and backend.
Backend (Hallo-Stroke-Backend)
config.GetEnv(key) fatals if a required variable is empty — the app refuses to start without all of these.
| Variable | Required | Description |
|---|---|---|
DATABASE_URI | yes | Postgres DSN (GORM, PreferSimpleProtocol: true) |
SERVER_PORT | yes | e.g. :3001 |
JWT_ACCESS_SECRET | yes | 64-byte hex recommended |
JWT_REFRESH_SECRET | yes | 64-byte hex recommended |
GOOGLE_MAPS_API_KEY | yes | Places Nearby + Details |
YOUTUBE_API_KEY | yes | YouTube Data API v3 |
WHATSAPP_API_ENDPOINT | yes | External gateway URL |
WHATSAPP_API_USERNAME | yes | Basic auth |
WHATSAPP_API_PASSWORD | yes | Basic auth |
FRONTEND_URL | yes | Used in WhatsApp deep-links (forum, article, video, reset password) |
SUPER_ADMIN_USERNAME | yes | Super-admin credentials |
SUPER_ADMIN_PASSWORD | yes | Super-admin credentials |
AES_ENCRYPTION_KEY | yes | 32-byte AES-GCM key for NIK encryption |
VAPID_PUBLIC_KEY | yes | Web push |
VAPID_PRIVATE_KEY | yes | Web push |
VAPID_SUBJECT | yes | Web push (mailto: or URL) |
Templates: .env.example, .env.production.example.
Frontend (hallo-stroke-bunny)
| Variable | Dev | Prod | Description |
|---|---|---|---|
REACT_APP_API_BASE_URL | http://localhost:3001/api | https://caef.cs.ui.ac.id/backend/api | API base |
REACT_APP_MEDIA_BASE | http://localhost:3001/ | https://caef.cs.ui.ac.id/backend | Media/image prefix |
REACT_APP_VAPID_PUBLIC_KEY | BCAULCVpfZgxn... | same | Web Push public key |
Templates: .env, .env.development, .env.production, nginx.env.example.
Secret committed in frontend repo
VAPID_PRIVATE_KEY is committed in the frontend .env. It must not live in the frontend repo — move it to the backend environment only. The frontend only needs the public key.
CORS
The backend allowlist (in cmd/main.go): https://hallostroke.org, http://localhost:3000, http://localhost:3003, http://localhost:5173. Credentials allowed, max age 86400. Add your frontend origin here if it differs.