dox 3.2.3
dox: ^3.2.3 copied to clipboard
This is a cli tool to generate migration, model and to handle database migration with dox framework. It support up and down methods to control migration version.
dox #
The dox command line tool. It creates projects and files, runs the dev server, builds for production and runs migrations.
Part of Dox, a web backend framework for Dart. Source code: github.com/dartondox/dox-cli.
Install #
dart pub global activate dox
If your shell can not find dox, add $HOME/.pub-cache/bin to your PATH.
dox update installs the newest version with the same major version.
Use it #
dox create my_app # a new project from the starter template
cd my_app
dart pub get
dox s # dev server, hot reloads or restarts when a file changes
dox create also makes the .env file with a new APP_KEY. Do not copy .env.example over it, or you lose that key.
Commands #
| Command | What it does |
|---|---|
dox create <name> |
create a new project |
dox serve (or dox s) [--ignore-build-runner] [--no-reload] |
start the dev server with build_runner watch. A change in lib/app/ hot reloads, other changes restart the server |
dox build |
build the native (AOT) bundle into build/bundle |
dox make:controller <name> [-r] [--api] [--model=<model>] |
create a controller. -r makes a resource controller, --api one without create and edit, --model one that uses the model |
dox make:model <name> [-m] [-c] [-r] [-f] [-s] [-a] [--api] |
create a model. -m migration, -c controller, -r resource controller, --api API resource controller, -f factory, -s seeder, -a all of them (-m -f -s -r). Join flags like -mcr |
dox make:dto <name> |
create a DTO (typed, checked input) |
dox make:job <name> |
create a queue job |
dox queue:work |
run the queue worker (also queue:failed, queue:retry, queue:forget, queue:flush, queue:clear, queue:restart, queue:prune-failed) |
dox schedule:work |
run the scheduler (also schedule:run, schedule:list, schedule:test, schedule:clear-cache) |
dox make:migration <name> [--sql] |
create a Dart or SQL migration |
dox migration:run (or dox migrate) |
run new migrations |
dox migration:rollback [--step=N] [--batch=N] |
undo the last batch, the last N migrations, or batch N only |
dox migration:fresh [--seed] |
drop all tables, then run all migrations |
dox make:factory <model> / dox make:seeder <name> |
create a model factory or a seeder |
dox db:seed [--class=<name>] |
run the seeders |
dox key:generate |
make a new APP_KEY (--show prints one and writes nothing; in production it asks first, --force skips the question) |
dox env:generate / dox env:check |
make or check the typed env class. env:generate reads .env.example, which is in git: never put a real secret there, and read the made class before you commit it. env:check checks with envExpand off; env:check --expand checks with it on |
dox openapi:generate [dir] |
write openapi.json and openapi.yaml |
dox route:list [--json] |
list every route of the app, without starting the server |
Run dox help for all commands.
Documentation #
Release #
Push a v<version> tag on main.
The tag must match version in pubspec.yaml and lib/src/version.dart.
The Release workflow publishes the package to pub.dev.
License #
MIT. See LICENSE.