Reference
Superflare CLI
Introduction
The Superflare CLI is a tool for building out your local Superflare app. In most cases, it's a wrapper around the wrangler
CLI, but it also provides some additional functionality.
$ npx superflare
Commands:
superflare migrate ๐๏ธ Migrate your database and update types
superflare dev [entrypoint] ๐ Start the development server
superflare generate ๐ Scaffold useful things [aliases: g]
superflare new [name] ๐ธ Create a new Superflare project
superflare console ๐ฎ Open an interactive developer console [aliases: c]
superflare db ๐๏ธ Manage your database
Options:
-v, --version Show version number [boolean]
-h, --help Show help [boolean]
superflare migrate
The migrate
command is one of the more useful commands in the Superflare CLI.
By default, it:
- Compiles your Superflare TS migrations to Wrangler SQL migrations
- (Optional with
-f
) Drops your local development database - Migrates your local database with
npx wrangler d1 migrations apply DB
- (Optional with
-s
) Seeds your local database - Parses the column types in your local database and syncs them to
superflare.env.d.ts
to be used by your Models
It takes the binding name of your D1 database as a positional argument, which is DB
by default:
npx superflare migrate DB
Superflareโs migrate
command is intended for use in development, both for managing your local database (e.g. wiping it clean to start fresh, seeding it, running migrations) and for creating the TypeScript types to match your database schema. To run your migrations in production when you are ready to deploy your latest, use wrangler directly:
npx wrangler d1 migrations apply DB --remote
superflare dev
The dev
command starts a local development server for your Superflare app. Itโs a wrapper around two commands: remix vite:dev
(starts the main Vite dev server) and wrangler dev --no-bundle
(enables working with Durable Object bindings). You can use it directly or put it in your package.json
โs scripts: "dev": "superflare dev"
.
superflare generate
Scaffold useful things in your Superflare app:
$ superflare generate
๐ Scaffold useful things
Commands:
superflare g job <name> Generate a Job
superflare g migration <name> Generate a Migration
superflare g model <name> Generate a Model
superflare generate job
Generates a new Job with the given name.
superflare generate migration
Generates a new Migration with the given name.
superflare generate model
Generates a new Model with the given name.
Optional: -m
or --migration
will generate a migration for the model as well.
superflare new
Allows you to create a new Superflare app.
superflare console
Opens an interactive developer console for your Superflare app. You can access all your models and perform queries against your local database.
superflare db
$ superflare db
๐๏ธ Manage your database
Commands:
superflare db seed ๐ฑ Seed your database with data
superflare db seed
Seeds your local database with data from your seed file.