Environment Variables
Configuring your environment correctly is critical for running AnswerFlow. Instead of a single global file, AnswerFlow uses specific environment files for each part of the monorepo to keep configurations clean and modular.
You must copy the .env.example to .env in the following directories:
apps/web/.env(For the Next.js frontend and API)apps/worker/.env(For the BullMQ background worker)packages/db/.env(For Prisma database migrations)
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_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
S3_ACCESS_KEY_ID: Your storage access keyS3_SECRET_ACCESS_KEY: Your storage secret keyS3_BUCKET_NAME: The name of the bucket (e.g.,answerflow)S3_ENDPOINT:https://{CLOUDFLARE_ACCOUNT_ID}.r2.cloudflarestorage.com
S3_ACCESS_KEY_ID: Root User in MinIO ContainerS3_SECRET_ACCESS_KEY: Root password in MinIO ContainerS3_BUCKET_NAME: The name of the bucket (e.g.,answerflow)S3_ENDPOINT:http://minio:9000S3_REGION: us-east-1S3_PATH_STYLE: "true"
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_API_KEY: Your resend api keyEMAIL_FROM_ADDRESS: The sender address (e.g.,noreply@answerflow.dev)
SENDGRID_API_KEY: Your sendgrid api keyEMAIL_FROM_ADDRESS: The sender address (e.g.,noreply@answerflow.dev)
MAILGUN_API_KEY: Your mailgun api keyMAILGUN_DOMAIN: Your mailgun domainEMAIL_FROM_ADDRESS: The sender address (e.g.,noreply@answerflow.dev)
SMTP_URL: Your smtp server urlEMAIL_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.
REDIS_URL: Your redis url
Only Redis url is needed for bullmq
QSTASH_URL: Your qstash urlQSTASH_TOKEN: Your qstash tokenQSTASH_CURRENT_SIGNING_KEY: Your qstash current signing keyQSTASH_NEXT_SIGNING_KEY: Your qstash next signing keyQSTASH_WEBHOOK_URL: Custom webhook url (Optional)
Not implemented yet
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