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.

This page walks you through running Betterflow on your local machine from scratch. By the end you will have a fully functional development server at localhost:3000 ready for editing and contributing. The only hard requirement is pnpm — the project enforces this through a preinstall hook, so attempting to use npm or Yarn will exit immediately with an error.

Prerequisites

Before you begin, make sure the following are available on your machine:
  • Node.js 18 or later — Betterflow uses Next.js 16 and React 19, both of which require a current Node.js runtime.
  • pnpm — The project’s package.json uses a preinstall hook (only-allow pnpm) that blocks all other package managers. Install it with npm install -g pnpm if you don’t have it yet.

Installation

1

Clone the repository

Clone the Betterflow repository from GitHub and navigate into the project directory.
git clone https://github.com/konlyzx/betterflow.git
cd betterflow
2

Install dependencies with pnpm

Install all project dependencies using pnpm.
pnpm install
You must use pnpm for this step. The project has a preinstall script that calls only-allow pnpm, which will immediately terminate the process if you run npm install or yarn install.
3

Copy the environment file

Copy the example environment file to create your local .env. For local development, no values need to be filled in immediately — see the note below about which variables are truly required.
cp .env.example .env
4

Start the development server

Start the Next.js development server. The --webpack flag is included in the dev script to keep the build pipeline consistent.
pnpm run dev
You should see output similar to:
▲ Next.js 16
- Local: http://localhost:3000
5

Open the app

Open your browser and navigate to http://localhost:3000. The Betterflow editor will load and you can start uploading screenshots immediately.

Environment Variables

Core editor features work without any environment variables configured. You can upload images, apply backgrounds, add frames, use 3D transforms, animate, and export PNG/JPG/video entirely without setting up external services.
The .env.example file documents every available variable. Here is a summary of what is required versus optional for local development:
VariableRequired for local dev?Purpose
NEXT_PUBLIC_SITE_URLOptionalSets the canonical site URL; defaults to http://localhost:3000
NEXT_PUBLIC_FIREBASE_API_KEYOptionalFirebase project API key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAINOptionalFirebase Auth domain
NEXT_PUBLIC_FIREBASE_PROJECT_IDOptionalFirebase project ID
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKETOptionalFirebase Storage bucket
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_IDOptionalFirebase messaging sender ID
NEXT_PUBLIC_FIREBASE_APP_IDOptionalFirebase app ID
NEXT_PUBLIC_R2_PUBLIC_URLOptionalPublic URL for your Cloudflare R2 bucket (needed for hosted background images)
NEXT_PUBLIC_R2_CUSTOM_DOMAINOptionalCustom domain in front of R2
NEXT_PUBLIC_CDN_URLOptionalCDN URL for serving R2 assets
R2_ACCESS_KEY_IDOptionalR2 API access key
R2_SECRET_ACCESS_KEYOptionalR2 API secret key
R2_BUCKET_NAMEOptionalName of the R2 storage bucket
CLOUDFLARE_ACCOUNT_IDOptionalYour Cloudflare account ID
R2_ACCOUNT_IDOptionalR2-specific account ID
R2_API_TOKENOptionalR2 API token
NEXT_PUBLIC_POSTHOG_KEYOptionalPostHog analytics API key
NEXT_PUBLIC_POSTHOG_HOSTOptionalPostHog host (defaults to https://us.i.posthog.com)
GOOGLE_SITE_VERIFICATIONOptionalGoogle Search Console verification token
CLEANUP_SECRETOptionalSecret token for the cache cleanup API route
The R2 variables as a group are needed only if you want to use hosted background images stored in a Cloudflare R2 bucket. All other editor functionality — including 3D transforms, animations, device frames, and video export — works fully offline without them.

What’s Next

Self-Hosting

Deploy Betterflow to Vercel or Docker for production use.

Environment Variables

Full reference for every configuration option.

Build docs developers (and LLMs) love