Admin app
The SaaS starters ship a separate admin app into your monorepo at apps/admin. It's a third surface next to
apps/frontend and apps/backend, built for operators (you and your team), not your end users. Both starters ship the
same admin, so you get it whether you pick WorkOS or
Better Auth.
What's inside
The admin app has its own login and a set of private, role-gated screens:
| Screen | Route | Who can open it |
|---|---|---|
| Dashboard | / | Any admin |
| Users | /users, /users/$userId | Any admin |
| Organizations | /orgs, /orgs/$organizationId | Any admin |
| Settings | /settings | Super admin only |
| Login | /login | Public |
On the backend, the starter adds /admin API routes (dashboard stats, users, orgs) and /admins/* for super-admin CRUD
of admin records. An admin Prisma model stores who has access beyond the bootstrap list.
How super-admin auth works
Admin access uses an AdminRole (super_admin or admin). Resolution order:
SUPER_ADMIN_EMAIL- comma-separated emails. Matching sign-ins are alwayssuper_admin, even with no row in theadmintable. This is how you get the first operator in.admintable - super admins add and manage these from the Settings screen. Middleware iswithAdmin/withSuperAdminon top of the same identity provider as the customer app.
Helpers live under apps/backend/src/features/admin/helpers/super-admin.ts and
apps/backend/src/utils/auth/admin-hono.ts (getAdminApp()).
Set the bootstrap list in apps/backend/.env:
SUPER_ADMIN_EMAIL=you@example.com,teammate@example.comHow feature packs extend the admin
Feature packs do not ship a second admin app. They plug into this one through pack manifests and codemods:
| Extension point | What packs do |
|---|---|
Nav slot admin | Adds sidebar entries (for example Notifications) |
| Dashboard rows | Injects metric cards into the dashboard |
| Extra routes / features | Adds API routes and admin UI modules under apps/admin and apps/backend |
| Org detail cards | Composes billing or license cards onto organization pages |
Examples:
- Billing (Stripe) adds a revenue row on the dashboard, org
billing cards, and
/admin/billingAPI routes. - Notifications adds a Notifications nav entry and admin send UI.
Install any of these on top of a starter and the widgets and routes show up automatically after the CLI finishes.
Where to add your own admin screens
- Add a route under
apps/admin/src/routes/(private)/... - Add backend routes under
apps/backend/src/routes/admin-...mounted withgetAdminApp()(orwithSuperAdminwhen only super admins should call them) - Gate UI with the same admin role checks the starter already uses
- Prefer composing into the dashboard or org detail pages when the feature is a metric or a card, not a whole section
Running it
pnpm devNx starts frontend, backend, and admin with hot reload. Sign in with a SUPER_ADMIN_EMAIL account.
Environment variables
| Variable | Purpose |
|---|---|
SUPER_ADMIN_EMAIL | Comma-separated bootstrap super admin emails. Optional but you need at least one to sign in the first time. |
Every purchase and sponsorship funds my 8+ years of work on open source given freely to the community. It keeps the lights on, funds new packs, and keeps the ecosystem alive. Even a small tier means a lot. Thank you!
