Installation
Azu runs inside your AdonisJS app, at /admin. You’ll add Bouncer, install Azu, and write one rule that says who gets in.
Requirements
Section titled “Requirements”- AdonisJS 7 with Lucid, Auth, and Bouncer.
- Inertia with React.
- Node.js 24.21 or later.
- PostgreSQL, MySQL, or SQLite.
The panel also needs Vite, Edge, an Inertia config and provider, and a session guard. Configure checks your app’s files before it makes changes. If it finds a Vite or Inertia config but can’t confirm its provider, it warns you and continues. See Ace commands for the checks.
Note: the React and Vue starter kits have everything but Bouncer. The Hypermedia kit needs two more steps, and the API kit isn’t supported yet. Starter kits has the details.
Install
Section titled “Install”-
Add Bouncer, if your app doesn’t have it. Azu’s access gate is a Bouncer ability, and the AdonisJS starter kits don’t include Bouncer.
Terminal window node ace add @adonisjs/bouncer -
Install Azu and its React package with the
previewtag, then configure Azu. Usepnpm addoryarn addif you prefer.Terminal window npm i @mezielabs/azu@preview @mezielabs/azu-react@previewnode ace configure @mezielabs/azuThe
@previewtag goes away at 0.1.0. From then on,node ace add @mezielabs/azuinstalls and configures in one step. -
Decide who gets in. Configuring adds an
accessAdminability toapp/abilities/main.tsthat returnsfalse, so nothing is exposed until you change it.
What configure does
Section titled “What configure does”Configuring Azu:
- registers its provider and creates
config/azu.ts. - mounts the panel at
/admin. - adds a separate Vite entry, so your public pages never load admin code.
- adds the
accessAdminability toapp/abilities/main.ts.
Let people in
Section titled “Let people in”accessAdmin decides who can open the panel. The demo store lets in admins and staff:
export const accessAdmin = Bouncer.ability((user: User) => { return user.role === 'admin' || user.role === 'staff'})On a fresh starter kit, allow your email while you try Azu locally. Add the User import and replace the generated accessAdmin ability:
import type User from '#models/user'
export const accessAdmin = Bouncer.ability((user: User) => { return user.email === 'you@example.com'})Note: if you added Azu before Bouncer, run node ace add @adonisjs/bouncer, then node ace configure @mezielabs/azu again to add the ability. Without Bouncer, Azu denies everyone.
Signing in
Section titled “Signing in”Azu uses your app’s existing auth guard. Guests are sent to your login page, and signed-in users who fail accessAdmin get a 403.
With session middleware, Azu remembers the admin page a guest asked for. Your login can send them back there. Troubleshooting shows the demo’s login controller.
Quick start generates your first resource.