Environment Variables
Configuring your environment correctly is critical for running the Answerflow. You can find the available variables in the .env.example file.
Copy .env.example to .env to get started.
Database & Redis
These are required to store data and handle background job queues.
DATABASE_URL: Connection string for PostgreSQL.REDIS_URL: Connection string for Redis.
Authentication (Better-Auth)
AUTH_SECRET: A secret value used for encryption and hashing. It must be at least 32 characters and generated with high entropy.
or using below command
openssl rand -base64 32 AUTH_URL: The URL where your Next.js application is hosted.
Storage (S3 / R2 / MinIO)
We use S3-compatible storage for user avatars and community media uploads. For local development, we provide a MinIO container in the Docker compose file.
Just choose your S3 provider
Aws S3
AWS_ACCESS_KEY_ID: Your aws access keyAWS_SECRET_ACCESS_KEY: Your aws secret keyS3_BUCKET_NAME: The name of the bucket (e.g.,answerflow)AWS_REGION: Your aws bucket region
NEXT_PUBLIC_CDN_URL: Your Bucket Public Url or CDN Url
The MinIO Trap
If you are using the Docker Compose setup with MinIO, you must set your S3_ENDPOINT to http://minio:9000 (or whatever your MinIO service name is) in your local .env.
Our system will automatically replace minio:9000 with localhost:9000 when generating presigned URLs for the browser. (Note: Next.js Image optimization is disabled when using MinIO).
Email Delivery
Answerflow supports different email providers to send emails like welcome email, password reset email, notification emails etc.
You can choose any one of the following.
Resend
RESEND_API_KEY: Your resend api keyEMAIL_FROM_ADDRESS: The sender address (e.g.,noreply@answerflow.dev)
Queue Adapters
Answerflow has multiple queue adapters for background jobs. You can choose any one of the following.
bullmq
REDIS_URL: Your redis url
Only Redis url is needed for bullmq
Push Notifications
Answerflow uses firebase for push notifications.
These are client side variables for firebase client sdk
NEXT_PUBLIC_FIREBASE_API_KEY: Your firebase web client api keyNEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: Your firebase web client auth domainNEXT_PUBLIC_FIREBASE_PROJECT_ID: Your firebase web client project idNEXT_PUBLIC_FIREBASE_STORAGE_BUCKET: Your firebase web client storage bucketNEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID: Your firebase web client messaging sender idNEXT_PUBLIC_FIREBASE_APP_ID: Your firebase web client app idNEXT_PUBLIC_FIREBASE_VAPID_KEY: Your firebase web client vapid key
These are server side variables for firebase admin sdk
FIREBASE_PROJECT_ID: Your firebase server project idFIREBASE_CLIENT_EMAIL: Your firebase server client emailFIREBASE_PRIVATE_KEY: Your firebase server private key