๐ŸŽธ
Theme

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:

  1. Compiles your Superflare TS migrations to Wrangler SQL migrations
  2. (Optional with -f) Drops your local development database
  3. Migrates your local database with npx wrangler d1 migrations apply DB
  4. (Optional with -s) Seeds your local database
  5. 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.

Previous
superflare.config