Skip to content

Flare, the fullstack framework for Cloudflare and Next.js

v0.12.2Twelve more field types, and relationships documented

The fullstack frameworkfor Cloudflare and Next.js

Describe a resource once. Flare writes the table, the API, the validation and the admin screens, with auth, storage and billing already wired — then ships it to Cloudflare Workers or to Vercel, from the same description.

npm create flare-framework@latest my-app
  1. $ npm create flare-framework@latest my-app
  2. ┌ Let's set up your Flare app
  3. ◇ Pick a look › default
  4. ◇ How can people sign in? › magic links, email codes, passkeys, 2FA
  5. ◇ Social sign-in? › Google, GitHub
  6. └ Creating your app
  7. ✔ Installed dependencies (1m 38s)
  8. ✔ Created my-app
localhost:3000
The home page of a new Flare app in the default theme
resources/contact.resource.tsyou write
import { defineResource, field } from "@flaredev/core";

export default defineResource({
  name: "Contact",
  fields: {
    name: field.string(),
    email: field.string({ format: "email" }),
    phone: field.string({ required: false }),
    status: field.enum(["lead", "customer"]),
  },
});
npx flare gen resource ContactFlare writes
  1. db/schema/contacts.tsDrizzle table
  2. migrations/0001_create_contacts.sqlMigration
  3. app/api/contacts/route.tsList and create
  4. app/api/contacts/[id]/route.tsRead, update, delete
  5. resources/contact.validators.tsZod validation
  6. resources/contact.client.tsTyped client
  7. app/admin/contacts/page.tsxAdmin table
  8. app/admin/contacts/new/page.tsxCreate form
  9. app/admin/contacts/[id]/edit/page.tsxEdit form

Edit the descriptor and run it again: every file follows, and your own code outside the generated blocks is kept.

Built on
  • Cloudflare
  • Next.js
  • Vercel
  • Drizzle
  • Prisma
  • D1 · SQLite
  • Postgres
  • Neon
  • Better Auth
  • Stripe
  • Resend
  • Upstash
  • React
  • TypeScript
  • Tailwind CSS
  • Zod

[ how it works ] Layers

One file at the top,
every layer underneath

The descriptor is the only thing you write. Each layer below is real code in your repository, generated from it and kept in step with it.

  1. 01Admin screensTable, form, record page, skeletonsapp/dashboard/contacts/*
  2. 02REST APICursor paging, filters, policiesapp/api/contacts/route.ts
  3. 03ValidationStrict Zod schemas, readable errorsresources/contact.validators.ts
  4. 04DatabaseTable, indexes, constraints, migrationdb/schema/contacts.ts

[ pick one ] Stacks

One description,
two places to run it

Your resources, hooks, policies, seeds and every component are the same on both. What changes is the database, the ORM and where it deploys — so pick for the database, because that is the part you cannot move in an afternoon.

Cloudflare Workers

default

Cheapest to run, everywhere at once.

Runtime
vinext on Workers
Database
D1 (SQLite)
ORM
Drizzle
Cache
Workers KV
Realtime
Durable Objects

A Worker runs in every Cloudflare location without you arranging it, and R2 charges nothing to serve what it stores. The trade is SQLite rather than Postgres, and a runtime that is not Node.

pnpm create flare-framework my-app

Next.js on Vercel

--stack next

Real Postgres, real Node.

Runtime
Next.js 16
Database
Neon Postgres
ORM
Prisma 7
Cache
Upstash Redis
Realtime
not on this stack

Extensions, window functions and ranked full-text search; any npm package that assumes Node; preview deployments. It costs more, and realtime has no equivalent here.

pnpm create flare-framework my-app -- --stack next

Compare them properly — including what each one cannot do.

[ 01 / 05 ] Create

Everything a real app needs,
wired on day one

flare create gives you a working app with sign-in, a database, an admin area and the Cloudflare bindings behind them, already connected. No choosing libraries, no glue code.

[ 02 / 05 ] Look

Six themes,
so no two apps look alike

Pick one when you create the app, switch with flare theme mono, or set FLARE_THEME. Sign-in, dashboard, admin and home page all follow: colours, type, button shapes and even the sign-in layout.

Sign-in screen, Default theme
Sign in
Home page, Default theme
Home page

Calm and centred, indigo accents. flare create my-app --theme default

[ 03 / 05 ] Secure

Every way to sign in,
already built

flare create asks which to switch on. Each has its screens, emails and account settings, and a method you switch off is refused by the API, not just hidden.

  • Email and passwordWith reset links and email verification.
  • Magic linksA one-time sign-in link by email.
  • Email codesA 6-digit code, for people who'd rather not click links.
  • PasskeysFace ID, Touch ID, Windows Hello or a security key.
  • Two-factorAuthenticator apps with backup codes, or codes by email.
  • Google, GitHub, Apple, MicrosoftEach switches on once its credentials are set.
  • Read the auth guide
The account page: profile, password, two-factor, passkeys and sessions

[ 04 / 05 ] Generate

Grow the app
one command at a time

Each generator writes plain, readable files into your project. Change them, or regenerate: Flare keeps your edits and tells you when something drifted.

A table, an API, validation and admin screens for any record your app keeps.

Read the guide
npx flare gen resource Deal --fields "title:string, value:int, stage:enum(lead,won,lost), company:belongsTo(Company)"
  • create db/schema/deals.ts
  • create app/api/deals/route.ts
  • create resources/deal.validators.ts
  • create app/admin/deals/page.tsx
  • create migrations/0002_create_deals.sql

And the code you write stays small

resources/deal.resource.ts
import { defineResource, field } from "@flaredev/core";
export default defineResource({
name: "Deal",
fields: {
title: field.string(),
value: field.int({ min: 0 }),
stage: field.radio(["lead", "won", "lost"]),
contact: field.email({ required: false }),
companyId: field.belongsTo("Company"),
},
});

[ 05 / 05 ] Ship

Live
in one command

flare deploy migrates the database first, deploys the Worker, then sets any secret you're missing — nothing to configure on the dashboard. On the Next.js stack the same command runs the Vercel CLI.

npx flare deploy
  • flare Applying migrations to my-app-db (remote)
  •   0001_create_contacts.sql ✓
  • flare Deploying
  •   Uploaded my-app
  • flare Generating BETTER_AUTH_SECRET for production
  • Deployed to https://my-app.you.workers.dev
114sfrom flare create to a deployed app that signs users up and serves its API, timed end to end on a fresh app.

Questions

Is it production-ready?

Flare is at 0.x: the generators, auth, admin and deploy are tested end to end on every release, but APIs can still change between minor versions. Pin your version and read the changelog before upgrading.

Do I need a Cloudflare account to start?

No. flare dev and flare start run everything locally, D1, R2, KV and Durable Objects included. You only need an account for flare deploy.

Can I edit the generated code?

Yes. Generated code lives inside marked blocks; everything outside them is yours and is never touched. Flare also tells you when you've edited inside a block, instead of overwriting it.

How is it different from Next.js on Vercel?

It runs vinext, Cloudflare's Next.js-compatible framework, on Workers. Flare adds what a Next.js app leaves to you: database, auth, admin, API, roles, billing and security, generated and wired together.

Can I change the theme later?

Any time: flare theme <name>, or FLARE_THEME in .env. Every screen follows, the admin included.

Build your first app
in the next five minutes