Skip to content
AzuAzu

Ace commands

Azu’s commands share one azu: namespace, so they sit together in node ace list.

Command What it does
node ace configure @mezielabs/azu Configures Azu once it’s installed. See Installation.
node ace azu:resource <Model> Generates a resource from a model, with its validators.
node ace azu:action <Name> Creates a reusable row or bulk action.
node ace azu:screen <Name> Creates a screen and its component, or a form screen.
node ace azu:publish [page] Copies one of Azu’s pages into your app to edit.
node ace azu:doctor Checks your setup.

node ace configure @mezielabs/azu checks prerequisites before writing files or installing packages. It exits with 1 if any of these checks fail:

  • vite.config.ts exists, along with either config/vite.ts or the Vite provider registration.
  • The Edge provider is registered in adonisrc.ts.
  • config/inertia.ts exists.
  • config/auth.ts declares a session guard.

If the Vite or Inertia config exists but configure can’t confirm its provider, it warns and continues. Register the provider if it’s missing. Azu checks for both at runtime and reports E_AZU_SETUP if either is unavailable.

From 0.1.0, node ace add @mezielabs/azu installs and configures in one step.

Terminal window
node ace azu:resource Product

Generates a resource from a model, read from the model and its database table. It writes app/admin/resources/<model>_resource.ts, plus create and update validators in app/validators.

Flag What it does
--no-validator Skips the validators.
--policy Generates a missing policy. It allows listing, viewing, and editing for anyone who passes accessAdmin. It allows creation when generated fields cover all required columns.
--readonly Skips validator generation. With --policy, a newly generated policy allows listing and viewing only.

The generator uses an existing policy as written. For a read-only resource, make sure that policy denies create, update, and delete.

Terminal window
node ace azu:action MarkAsPaid

Creates a reusable row action in app/admin/actions. It has an ability, a confirmation, and a handler that uses the action’s transaction. The ability is the name in camelCase: MarkAsPaid becomes markAsPaid.

Flag What it does
--bulk Makes a bulk action, for selected rows.
--force, -f Overwrites the file if it exists.

It refuses the name delete, which every resource with a delete policy method already has.

Terminal window
node ace azu:screen SalesReport

Creates a screen in app/admin/screens and its component in inertia/admin/components. It’s ready to open at /admin/screens/<name>, with accessAdmin as its ability.

Flag What it does
--form Writes a form screen and its validator in app/validators instead, with no component.
--force, -f Overwrites the files if they exist.
Terminal window
node ace azu:publish resource/index

Copies one of Azu’s pages into inertia/admin/pages for editing, stamped with the version it came from. Without a page, it lists them. See Customising.

Flag What it does
--force, -f Overwrites a page you already published.
Terminal window
node ace azu:doctor

Boots your app and checks config, policies, validators, components, widgets, and published pages. It exits with 1 when it finds an error. azu:doctor checks lists every check.