Skip to content

Dox CLI

Dox has a CLI tool to generate migration, model and to handle database migration which support up and down methods to control migration version.

Installation

dart pub global activate dox

Export bin path

Please make sure you have included bin path to your profile. If you did not added path to your profile yet, open ~/.bashrc or ~/.zshrc and paste below line.

export PATH="$PATH":"~/.pub-cache/bin"

Tips

You can also use bin/dox {command} from your project folder to run server or create migration etc..

Update package

dox update

Crete new project

dox create new_blog

Serve project

Run http server.

dox serve 
or 
dox s

dox s --ignore-build-runner // ignore build runner watch

Run build runner

dox build_runner:watch
dox build_runner:build

Build project for production

dox build (compile into machine code)
bin/server (run exec file to serve http server)

Generate app key

dox key:generate

Create controller

dox create:controller admin_controller
dox create:controller admin_controller -r
dox create:controller admin_controller -ws

Create middleware

dox create:middleware auth_middleware

Create migration

dox create:migration create_foo_table

Create model

dox create:model ModelName
dox create:model ModelName -m

Run migration

dox migrate

Info

To run migration, make sure that you have create .env file with with below variable names.

DB_HOST=localhost
DB_PORT=5432
DB_NAME=postgres
DB_USERNAME=admin
DB_PASSWORD=password

Rollback migration

dox migrate:rollback

Deactivate CLI

dart pub global deactivate dox