Finch CLI

The Finch CLI is a command-line tool for creating projects, running the dev server, building, running tests, and managing database migrations. It wraps common Dart commands and adds Finch-specific tasks.

Install

dart pub global activate finch

Commands

Run finch -h to see all available commands:

finch -h
✔ templates
        Show the list of available templates
✔ create
        Make new project
        -p, --path       Path of the project
        -n, --name       Name of project
        -d, --docker     Use docker
        -t, --template   Project template [simple, example,...]
✔ get
        Get packages of project (dart pub get)
✔ runner
        Build runner of project (dart pub run build_runner build)
✔ run
        Run project (dart run)
        -p, --path       Path of app file
        -a, --args       Arguments for app file
✔ serve
        Serve project with file watcher
        -p, --path       Path of app file
        -a, --args       Arguments for app file
✔ build
        Build project (dart compile exe)
        -c, --cli        Build for CLI
        -a, --appPath    Path of app file
        -l, --langPath   Languages path
        -p, --publicPath Public path
        -w, --widgetPath Widgets path
        -e, --envPath    Environment file (.env) path
        -o, --output     Output path
        -t, --type       Type of build (zip, exe)
✔ migrate
        Manage MySQL and SQLite migrations
        -c, --create     Create a new migration file
        -n, --name       Name of migration file (only with --create)
        -s, --sqlite     Target SQLite instead of MySQL
✔ test
        Run unit tests (dart test)
        -r, --reporter   Set how to print test results

        -h, --help       Show help
        -v, --version    Show Finch version
        -u, --update     Update Finch CLI

Common Usage Examples

Create a new project with the example template

finch create -n my_app -t example

Run the dev server with file watcher

The serve command watches widget and language files and hot-reloads them without restarting the server:

finch serve

Or specify the entry point:

finch serve -p lib/serve.dart

Build a production binary

finch build -a lib/app.dart -o ./build/app

Run database migrations

# Apply all pending MySQL migrations
finch migrate --init

# Create a new MySQL migration file
finch migrate --create --name add_users_table

# Apply SQLite migrations
finch migrate --init --sqlite

The migrate command delegates to the running app's built-in migration system. See Database Migration for details.