Skip to content

🛡️ Admin Dashboard

Database Server Actions Auth Required RBAC

Module ID: @saas/admin | Version: 1.0.0

User management admin panel gated by 3-tier RBAC (admin-only). Provides user table, role selector, and delete-user action.

Installation

bash
npx shadcn@latest add @saas/admin

Dependencies

  • @saas/auth
  • @saas/rbac

Routes

  • (dashboard)/admin/page.tsx

Server Actions

  • actions/admin.ts

Database Tables

  • users

Post-Install Steps

Step 1 (manual): Verify the role enum migration is present. The users table must have a 'role' pgEnum column with values ['admin', 'editor', 'viewer']. Run: pnpm db:generate && pnpm db:migrate if the column is missing.

Step 2 (manual): Wire the admin nav link in your sidebar. Add a conditional link to '/dashboard/admin' visible only when isAdmin(session.user.role) is true. Import isAdmin from '@/lib/is-admin'.

Live Demo

https://your-app.zeabur.app/demo/admin Open ↗
🖥️
Admin Dashboard — Live Demo

Configure your deployed Next.js app URL via the VITEPRESS_DEMO_BASE environment variable, then rebuild to enable live iframe embeds.

View demo at https://your-app.zeabur.app/demo/admin

API Demonstration

GET/api/demo/admin/users
Base URL (your deployed Next.js app)
Authorization Header (optional)
Try in Live App →

Server Actions note: Server Actions ("use server") are not callable cross-origin. Use the "Try in Live App" link above to interact with them.

Released under the MIT License.