Optional Workers AI
FLUX models can use the AI binding. Local remote inference requires WORKERS_AI_REMOTE=true and a Cloudflare login; usage is billed to your account.
ai → AIAll in Cloudflare · AI built in
TanStack Start on Cloudflare Workers, with D1, R2 and Queues. Text, images and speech default to OpenAI; video uses a separate provider.
The live demo is served by Flare's own Worker, D1, R2 and Queues.
Your Cloudflare account
Hello, local user
A quiet place to build the next useful thing.
AI studios
D1· SQLite database
Users, sessions, AI tasks, the credit ledger and payment events live in D1. Credits are reserved together with the task and its outbox message in one batch, so a retry never charges twice. Migrations are versioned, and risky ones are checked before deployment.
Compute, data, files, queues and mail run in your Cloudflare account. OpenAI, other model providers, payments and OAuth are external services.
Media tasks reserve credits, run on Queues, store outputs in R2 and settle once. Chat streams through the Worker and shares the credit ledger.
A cozy reading nook by a rainy window, warm lamp light, a cat asleep on a knitted blanket, cinematic photograph




Request path
Request checkedWorker
Session, origin and a D1 rate limit come first, then the prompt, ratio and model are validated.
POST /api/ai/imagesCredits reservedD1
The task, its credit reservation and an outbox message are written in one atomic batch.
ledger · :reserve: · outboxJob leasedQueues
The outbox hands the task to JOBS, and a lease token lets exactly one consumer run it.
JOBS · lease_tokenImage generatedProvider adapter
OpenAI generates or edits the image through the server-side adapter.
OpenAI · images/generations · images/editsSaved privatelyR2
Each image is stored as PNG under the owner's prefix in R2.
{user}/ai/{asset}.pngSettled onceD1
Success keeps the reservation. A failure releases it, exactly once.
succeeded · :release: on failureFLUX models can use the AI binding. Local remote inference requires WORKERS_AI_REMOTE=true and a Cloudflare login; usage is billed to your account.
ai → AIText, images and speech use OpenAI adapters; video keeps a separate provider. The studios share credit accounting.
ImageProvider · VideoProviderLocal development uses deterministic mock media saved to local R2: no keys, no spend. AI_MODE=live switches to real models.
AI_MODE=mock | liveHistorical Flare samples, not regenerated with the new defaults. Model labels and prices show the current configuration; quality, quotas and costs depend on your accounts.
Generations cost credits, credits come from plans and packs, and every number is checked on the server before a provider is called.
Credit ledger
Each entry id is built from the user, the kind and the task, so retries, redelivery and double clicks cannot charge or refund twice. The usage page shows every line.
ledgerbalance 950
Sell credits
Subscriptions and lifetime plans grant credits, and one-time packs top them up. Credits are fixed on the order at checkout, through any of the four gateways.
plan
Pro
1,000 / month
plan
Lifetime
10,000
pack
Top-up
1,000
Cost guards
402429503:release:/app/adminCompute, data, files, AI, jobs, mail and logs are bindings on the same Worker. You inherit a platform instead of assembling one.
Your Cloudflare account
D1, R2, Workers AI, Queues, Cron Triggers and Email Sending are native bindings. Development, preview and Workers tests run the same code.
{
"main": "src/server.ts",
"d1_databases": [{ "binding": "DB" }],
"r2_buckets": [{ "binding": "R2_BUCKET" }],
"ai": { "binding": "AI" },
"send_email": [{ "name": "EMAIL" }],
"queues": { "producers": [{ "binding": "JOBS" }] },
"triggers": { "crons": ["*/5 * * * *"] }
}
No adapter layer
The Cloudflare Vite plugin emits a Worker. There is no OpenNext conversion step between your app and the edge.
Build path
Next.js → OpenNext → Worker
TanStack Start → Cloudflare Vite plugin → Worker
Fewer secrets
The database, files, model, queue and mailbox are reached through the Worker. Runtime secrets stay limited to AUTH_SECRET plus the providers you enable.
Reached by binding, not by key
Still a secret when you enable it
Services you would normally sign up for and hold keys to one by one are, in Flare, bindings on a single Worker.
Seven services you would usually buy separately, already attached to one Worker.
Usually assembled by hand
Several dashboards, several key sets, several bills
In Flare
One account, one wrangler.jsonc, one CLI
src/server.tsDBR2_BUCKETAI · provider adaptersJOBS*/5 * * * *EMAILTanStack Start builds into a Worker through Cloudflare's official Vite plugin, without an OpenNext-style translation step. Development, preview and tests all run Workers-compatible code.
@cloudflare/vite-pluginpnpm muse:init creates a local D1 database, generates AUTH_SECRET and seeds two test accounts. No Cloudflare account and no Docker required.
pnpm muse:initDatabase, files, AI, queues and email all go through bindings. The Worker only stores the auth secret plus the CAPTCHA, OAuth and payment credentials you enable.
AUTH_SECRETLocal development never touches the cloud. Before deploying, you see exactly what will be created and which migrations will run; after publishing, public smoke checks run automatically. Every command returns stable JSON and exit codes, ready for CI.
Initialize locally
Generates AUTH_SECRET, applies local D1 migrations and seeds two test accounts. No Cloudflare credentials at any point.
pnpm install --frozen-lockfile
pnpm muse:init
command: init
initialized: true
next: [
"pnpm dev",
"Local accounts: [email protected] and [email protected] (see README)",
"Verification and reset links are captured at /dev/mail",
"Production secrets: .muse/production.secrets.json (gitignored)"
]
The plan is read-only and creates nothing. A pending migration containing DROP, TRUNCATE, DELETE or UPDATE SET blocks automated deployment.
MuseMVP Base holds the two Next.js apps in the musemvp repository. MuseMVP Flare is its own repository, built for Workers from the first line, and the only edition with the AI studios.
Framework
Next.js + Node · MuseMVP BaseNext.js 16
Next.js + Cloudflare · MuseMVP BaseNext.js 16 + OpenNext
TanStack Start + Cloudflare + AI · MuseMVP FlareTanStack Start + Vite
Runtime
Next.js + Node · MuseMVP BaseNode.js on Vercel or Docker
Next.js + Cloudflare · MuseMVP BaseCloudflare Workers via OpenNext
TanStack Start + Cloudflare + AI · MuseMVP FlareWorkers, natively via the Cloudflare Vite plugin
Data & files
Next.js + Node · MuseMVP BasePostgreSQL · S3-compatible storage
Next.js + Cloudflare · MuseMVP BaseD1 · R2
TanStack Start + Cloudflare + AI · MuseMVP FlareD1 · R2
AI studios & jobs
Next.js + Node · MuseMVP BaseNot built in
Next.js + Cloudflare · MuseMVP BaseNot built in
TanStack Start + Cloudflare + AI · MuseMVP FlareTanStack Start on Cloudflare Workers, with D1, R2 and Queues. Text, images and speech default to OpenAI; video uses a separate provider.
Local development
Next.js + Node · MuseMVP BasePostgreSQL in Docker Compose
Next.js + Cloudflare · MuseMVP BaseWrangler local D1, no Docker
TanStack Start + Cloudflare + AI · MuseMVP FlareLocal D1, no Docker or cloud credentials
Deploy
Next.js + Node · MuseMVP BaseVercel or your own Docker host
Next.js + Cloudflare · MuseMVP Basepnpm cf:deploy to Workers
TanStack Start + Cloudflare + AI · MuseMVP Flarepnpm muse:deploy: plan → yes → verify
Choose it when
Next.js + Node · MuseMVP BaseYou need PostgreSQL, self-hosting or long-running Node processes.
Next.js + Cloudflare · MuseMVP BaseYou want one platform, an edge runtime and the least infrastructure to operate.
TanStack Start + Cloudflare + AI · MuseMVP FlareAn AI product you want to charge for, with the lightest path from laptop to Workers.
MuseMVP Base includes both Next.js apps, MuseMVP Flare includes this codebase, and All in One includes all three plus every UI template.
Compare all plansapps/web holds the interface and the Worker entry; domain logic lives in packages. Hover any entry to preview the real source.
Explorer
Reviewed excerpts, generated at build time.
Read the structure guideFour plans. One payment.
Every plan is a one-time, tax-inclusive purchase. MuseMVP Base and MuseMVP Flare cost the same: pick the stack you build on. Flare adds AI image, video, voice and chat studios. All in One includes every repository.
Both stacks + UI
Base + Flare + UI templates
Base, Flare and every UI template, plus new ones.
Buy All in OneFull-stack foundation
Stack & deployment
AI capabilities
UI landing-page templates
After payment, connect GitHub in the Dodo Customer Portal, then accept each repository invitation.
Full-stack · pick one
AI SaaS, all in Cloudflare
TanStack Start on Cloudflare, with four AI studios built in.
Buy MuseMVP FlareFull-stack foundation
Stack & deployment
AI capabilities
UI landing-page templates
After payment, connect GitHub in the Dodo Customer Portal, then accept each repository invitation.
Full-stack · pick one
Next.js SaaS starter
Next.js for Node and for Cloudflare, with auth, payments and admin.
Buy MuseMVP BaseFull-stack foundation
Stack & deployment
AI capabilities
UI landing-page templates
After payment, connect GitHub in the Dodo Customer Portal, then accept each repository invitation.
Frontend only
UI landing pages
9+ editable Next.js landing-page templates.
Buy UI TemplatesFull-stack foundation
Stack & deployment
AI capabilities
UI landing-page templates
After payment, connect GitHub in the Dodo Customer Portal, then accept each repository invitation.
Every plan includes
One developer. Multiple commercial products and private client-project source handoff. No source redistribution or template resale.
Keep the versions you receive forever. Updates and new templates are included while the same product line is maintained, not future independent products or unlimited services.
There is no self-serve upgrade or price-difference checkout. Need to switch plans? Contact support.
Which plan includes Flare, how it differs from Base, AI models and costs, and local development.
MuseMVP Flare and All in One. MuseMVP Base covers the two Next.js apps only, and the UI Templates plan includes no engineering template.
Pick the stack. Choose Base for Next.js on Node with PostgreSQL, or Next.js on Workers. Choose Flare for TanStack Start running entirely on Cloudflare, with the AI studios, credit billing and cost guards built in. All in One includes both.
Set server-side OPENAI_API_KEY for default text, images and speech. Workers AI is optional; video needs a separate provider key. Models and prices live in packages/ai.
Media tasks enforce credit, concurrency and daily cost limits and return credits on final failure. Chat, summaries and prompt enhancement need provider-side spending limits too.
Compute, data, files, queues and mail run in your Cloudflare account. OpenAI, other model providers, payments and OAuth are external services.
Local development uses mock mode without keys or spend. For OpenAI, set OPENAI_API_KEY in apps/web/.dev.vars and AI_MODE=live. Only Workers AI needs wrangler login and WORKERS_AI_REMOTE=true.
Workers, D1, R2, Queues and Workers AI are billed by usage with included allowances, and premium model providers bill you directly. The template does not promise zero cost. Email Sending needs the service activated and a verified sender domain, and transactional mail to arbitrary recipients currently requires Workers Paid. Check current pricing.
Yes. The UI templates are built on Next.js; adapt routing and framework-specific components when bringing them into TanStack Start.
Workers · D1 · R2 · AI · Queues · Email
Sign-in, payments, credits, four AI studios and deployment tooling are ready. Start from a running Worker, not an empty repository.
pnpm muse:initpnpm devmuse:deploy --planmuse:deploy --yes