Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/betterspacx/app/llms.txt

Use this file to discover all available pages before exploring further.

Betterflow is configured entirely through environment variables loaded at build and runtime. Copy the provided template, fill in your values, and restart the development server — no other configuration files need to be touched.
cp .env.example .env
Open the newly created .env file and populate the sections below. Variables prefixed with NEXT_PUBLIC_ are embedded into client-side bundles at build time and are safe to expose to the browser; all others remain server-side only.

Site Configuration

VariableRequiredDefaultDescription
NEXT_PUBLIC_SITE_URL✅ Yeshttp://localhost:3000Canonical URL of your deployment. Used in SEO metadata, Open Graph tags, and absolute link generation. Set to your production domain before deploying.
NEXT_PUBLIC_SITE_URL=https://yourdomain.com

Firebase

Betterflow includes Firebase configuration for authentication and other Firebase services.
VariableRequiredDescription
NEXT_PUBLIC_FIREBASE_API_KEY✅ Yes (for Firebase)Firebase project API key, found in your Firebase project settings under General → Your apps.
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN✅ Yes (for Firebase)Firebase authentication domain (e.g. your-project.firebaseapp.com).
NEXT_PUBLIC_FIREBASE_PROJECT_ID✅ Yes (for Firebase)Firebase project ID (e.g. your-project-id).
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET✅ Yes (for Firebase)Firebase Storage bucket URL (e.g. your-project.appspot.com).
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID✅ Yes (for Firebase)Firebase Cloud Messaging sender ID, found in your Firebase project settings.
NEXT_PUBLIC_FIREBASE_APP_ID✅ Yes (for Firebase)Firebase app ID for your web app, found in your Firebase project settings.
NEXT_PUBLIC_FIREBASE_API_KEY=your_firebase_api_key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your-project-id
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your-project.appspot.com
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id

Cloudflare R2 Storage

R2 storage powers two key features: background image assets served to the editor and Chrome extension video uploads that land directly in R2 via presigned URLs. All R2 variables below should be treated as a group — the application will fall back gracefully when they are absent, but background images and extension uploads will be unavailable.
VariableRequiredDescription
CLOUDFLARE_ACCOUNT_ID✅ Yes (for R2)Your Cloudflare account ID, found in the Cloudflare dashboard sidebar. Required for constructing the R2 S3-compatible endpoint URL.
R2_ACCOUNT_ID✅ Yes (for R2)R2-specific account ID used in R2 API calls. Often the same value as CLOUDFLARE_ACCOUNT_ID.
R2_ACCESS_KEY_ID✅ Yes (for R2)R2 API access key ID. Generated in the Cloudflare dashboard under R2 → Manage API tokens.
R2_SECRET_ACCESS_KEY✅ Yes (for R2)R2 API secret access key paired with R2_ACCESS_KEY_ID. Never expose this in client-side code.
R2_BUCKET_NAME✅ Yes (for R2)Name of the R2 bucket (e.g. betterflow-storage). Passed directly to S3-compatible API calls.
R2_API_TOKEN✅ Yes (for R2)Scoped Cloudflare API token with R2 read/write permissions. Used for management API calls distinct from the S3-compatible access key pair.
NEXT_PUBLIC_R2_PUBLIC_URL✅ Yes (for R2)Public HTTPS endpoint of your R2 bucket (e.g. https://pub-xxxx.r2.dev). Used by next.config.ts as an allowed image hostname and in client-side asset URLs.
NEXT_PUBLIC_R2_CUSTOM_DOMAIN✅ Yes (for R2)Custom domain mapped to your R2 bucket (e.g. assets.yourdomain.com). Added as an allowed remote pattern for Next.js Image Optimization.
NEXT_PUBLIC_CDN_URL✅ Yes (for R2)CDN or custom domain base URL used when constructing public file URLs after upload (e.g. https://cdn.yourdomain.com).
CLOUDFLARE_ACCOUNT_ID=your_cloudflare_account_id
R2_ACCOUNT_ID=your_r2_account_id
R2_ACCESS_KEY_ID=your_r2_access_key_id
R2_SECRET_ACCESS_KEY=your_r2_secret_access_key
R2_BUCKET_NAME=betterflow-storage
R2_API_TOKEN=your_r2_api_token
NEXT_PUBLIC_R2_PUBLIC_URL=https://pub-xxxx.r2.dev
NEXT_PUBLIC_R2_CUSTOM_DOMAIN=assets.yourdomain.com
NEXT_PUBLIC_CDN_URL=https://cdn.yourdomain.com
Core editor features — image upload, 3D transforms, text overlays, animations, and PNG/video export — all work without R2 configured. R2 is only required if you want the built-in background image gallery or Chrome extension video uploads to function.

Analytics

Betterflow proxies PostHog through the same origin (/svc/...) to bypass ad blockers. Leave these variables unset to disable analytics entirely — the proxy rewrites in next.config.ts are harmless when no key is configured.
VariableRequiredDefaultDescription
NEXT_PUBLIC_POSTHOG_KEY⬜ OptionalPostHog project API key (phc_…). Enables event tracking and product analytics.
NEXT_PUBLIC_POSTHOG_HOST⬜ Optionalhttps://us.i.posthog.comPostHog ingestion endpoint. Change to https://eu.i.posthog.com for EU data residency.
NEXT_PUBLIC_POSTHOG_KEY=phc_your_posthog_api_key
NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com

SEO

VariableRequiredDescription
GOOGLE_SITE_VERIFICATION⬜ OptionalGoogle Search Console site verification token. Added as a <meta> tag in the page <head>.
GOOGLE_SITE_VERIFICATION=your_google_site_verification_code

Internal

VariableRequiredDescription
CLEANUP_SECRET⬜ OptionalSecret token used to authenticate requests to the /api/cleanup-cache route. Set this to a random string to prevent unauthorized cache clearing.
CLEANUP_SECRET=your_random_secret_string

Build docs developers (and LLMs) love