LogoAnswer Flow

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.
You can generate a secret by clicking

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 key
  • AWS_SECRET_ACCESS_KEY: Your aws secret key
  • S3_BUCKET_NAME: The name of the bucket (e.g.,answerflow)
  • AWS_REGION: Your aws bucket region
  • S3_ACCESS_KEY_ID: Your storage access key
  • S3_SECRET_ACCESS_KEY: Your storage secret key
  • S3_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 Container
  • S3_SECRET_ACCESS_KEY: Root password in MinIO Container
  • S3_BUCKET_NAME: The name of the bucket (e.g.,answerflow)
  • S3_ENDPOINT: http://minio:9000
  • S3_REGION: us-east-1
  • S3_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 key
  • EMAIL_FROM_ADDRESS: The sender address (e.g., noreply@answerflow.dev)
  • SENDGRID_API_KEY: Your sendgrid api key
  • EMAIL_FROM_ADDRESS: The sender address (e.g., noreply@answerflow.dev)
  • MAILGUN_API_KEY: Your mailgun api key
  • MAILGUN_DOMAIN: Your mailgun domain
  • EMAIL_FROM_ADDRESS: The sender address (e.g., noreply@answerflow.dev)
  • SMTP_URL: Your smtp server url
  • EMAIL_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 url
  • QSTASH_TOKEN: Your qstash token
  • QSTASH_CURRENT_SIGNING_KEY: Your qstash current signing key
  • QSTASH_NEXT_SIGNING_KEY: Your qstash next signing key
  • QSTASH_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 key
  • NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: Your firebase web client auth domain
  • NEXT_PUBLIC_FIREBASE_PROJECT_ID: Your firebase web client project id
  • NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET: Your firebase web client storage bucket
  • NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID: Your firebase web client messaging sender id
  • NEXT_PUBLIC_FIREBASE_APP_ID: Your firebase web client app id
  • NEXT_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 id
  • FIREBASE_CLIENT_EMAIL: Your firebase server client email
  • FIREBASE_PRIVATE_KEY: Your firebase server private key

On this page