Skip to content
AzuAzu

Quick start

Generate a resource for the starter kit’s User model. In an existing app, you can use another model with a migrated table.

  1. Run your migrations and generate the resource. The generator reads the model and its database table.

    Terminal window
    node ace migration:run
    node ace azu:resource User --policy
  2. Start your dev server.

    Terminal window
    npm run dev
  3. Sign up at /signup with the email you allowed in accessAdmin. If you already have that account, sign in at /login.

  4. Open /admin and choose Users. You can search the list, open a user, and edit their details. Use the app’s signup page to create users. The generated policy omits create because the required password has no generated admin field.

For User, azu:resource writes these files:

  • The resource in app/admin/resources/user_resource.ts.
  • Create and update validators in app/validators/user_admin.ts. The starter kit already has app/validators/user.ts. Pass --no-validator to skip generating validators.
  • With --policy, a policy in app/policies/user_policy.ts if that file is missing.

Anyone who passes accessAdmin can list, view, and edit users under the generated policy. It denies deletion by omitting delete. Review the resource and restrict the policy to the roles you want before deploying.

Run node ace codegen once before you typecheck:

Terminal window
node ace codegen
npm run typecheck

Bouncer’s middleware imports #generated/policies, which codegen writes. So npm run typecheck fails on a fresh app until codegen has run once. The dev server runs it for you.