Admin Dashboard and User Management
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:studioand 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 (
testimonialslayer) - Manage the waitlist (
waitlistlayer) - Manage app-wide banners (
bannerlayer)
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.
Polar
Accept payments with Polar through the better-auth plugin: a Polar customer on sign-up, checkout for signed-in users and the customer portal.
Overview
Optimize images with Nuxt Image and TwicPics, and store file uploads locally or in S3-compatible storage such as Cloudflare R2 with type and size checks.