Skip to content

Admin Dashboard and User Management

Manage users, testimonials, the waitlist and banners in the Nuxt Starter Kit admin dashboard, built on better-auth's admin plugin with role-based access.
You can test all features by logging in with the demo admin user. Click the Login button inside the alert on the demo app login page:All non-GET requests are blocked for the demo app, to prevent any changes to the database. You can test all features in the demo app, but you can't make any changes to the database.

Enable Admin Role

The kit uses better-auth's admin plugin. A user is an admin when the role column of the user contains admin (better-auth stores several roles comma-separated, e.g. user,admin).

You can set it via:

  • Drizzle Studio: Run pnpm db:studio and edit the user directly
  • SQL query: Connect to your PostgreSQL database and run:
    UPDATE "user" SET role = 'admin' WHERE email = '[email protected]';
    

Features

The user admin is part of the required dashboard layer:

  • List all users and perform actions:
    • Create
    • Delete
    • Ban/unban
    • Impersonate

The optional layers add their own admin pages and register them in the admin navigation. Delete a layer and its admin page goes with it:

  • Manage testimonials (testimonials layer)
  • Manage the waitlist (waitlist layer)
  • Manage app-wide banners (banner layer)

Access Control

Admin pages are protected by the dashboard's admin middleware. Every admin API handler also calls requireAdmin(event), which returns 401 without a session and 403 without the admin role. See Authentication.