Platform Setup
The admin area is protected by a named role:
platform_adminThe route guard does not infer this from organization ownership. A user must
actually have the platform_admin role in their user record.
What Admin Access Unlocks
Section titled “What Admin Access Unlocks”A verified user with platform_admin can access:
/admin- admin stats
- user moderation
- organization management
- plan quota overrides
- subscription overview
- waitlist moderation
Without that role, /admin redirects back toward the regular app flow.
Option 1: Bootstrap With INITIAL_ADMIN_EMAIL
Section titled “Option 1: Bootstrap With INITIAL_ADMIN_EMAIL”The shipped template includes a Nitro plugin that checks:
INITIAL_ADMIN_EMAIL=you@example.comAt startup, it will:
- look for an existing user with that email
- add
platform_adminif the user exists - write an audit log with source
env-bootstrap
Important behavior:
- if the email is missing, nothing happens
- if the user does not exist yet, the plugin logs a warning and skips the grant
- if the user already has
platform_admin, it does nothing
That means this is a startup-time bootstrap, not a background listener. If the user signs up after the server is already running, restart the app or use the grant script below.
Option 2: Use The Grant Script
Section titled “Option 2: Use The Grant Script”The template also ships a dedicated bootstrap command:
pnpm admin:grant-platform-admin -- you@example.comnpm run admin:grant-platform-admin -- you@example.comyarn admin:grant-platform-admin -- you@example.comThe script:
- validates the email
- looks up the target user
- refuses to create a second platform admin unless you pass
--force - writes an audit log with source
bootstrap-command
If you intentionally need to grant a second platform admin:
pnpm admin:grant-platform-admin -- you@example.com --forcenpm run admin:grant-platform-admin -- you@example.com --forceyarn admin:grant-platform-admin -- you@example.com --forceRecommended First-Run Flow
Section titled “Recommended First-Run Flow”- create the first real user account
- set
INITIAL_ADMIN_EMAILto that email and restart the app, or run the grant script - sign out and sign back in so the new role appears in session
- open
/admin - confirm non-admin users are still blocked