Admin UI
The admin section lives under /admin/*. Wrapped in AdminLayout (sidebar + outlet). Access guarded by RequirePlatformAdmin.
Pages
| Path | Component | Status |
|---|---|---|
/admin | AdminOverview | KPIs (some live, some mock) |
/admin/leads | AdminLeads | Mock data — pipeline view |
/admin/customers | AdminCustomers | Mock data — paying customers + MRR |
/admin/vendors | AdminVendors | Mock data — agent publishers |
/admin/agents | AdminAgents | Live — CRUD table |
/admin/agents/new | AdminAgentSubmit | Live — create form |
/admin/agents/:id/edit | AdminAgentEdit | Live — edit form |
/admin/interactions | AdminInteractions | Live — event log |
Guard
RequirePlatformAdmin checks useAuth().role === 'platform_admin'. On failure, redirects to /unauthorized. The check is client-side only — the backend re-enforces via PlatformAdminGuard on every write.
AdminAgents
Lists all agents including drafts and inactive. Filter by status. Actions: edit, view, soft-delete.
Internally uses useAgents() with the admin-only ?status=all query param (only honored if the request has platform_admin role).
AdminAgentSubmit / AdminAgentEdit
Form built with shadcn/ui form primitives. Fields:
- Basic: name, slug, tagline, description, longDescription.
- Branding: iconUrl (upload), photoUrls (upload, ordered).
- Status + flags: status, featured, isNew, comingSoon.
- Links: productDomain, docsUrl, changelogUrl.
- OAuth: redirectUris (one per line).
- Tags: multi-select.
- Pricing tiers: child editor (add, remove, set isFree / price / interval / features).
- Capabilities: child editor (icon picker + title + description).
- Steps: child editor (title + description).
- Changelog: child editor.
- Metric definitions: child editor (slug immutable after save).
- Tier quotas: matrix of (tier × metric) with NULL / 0 / N inputs.
On submit, sends one POST /agents/:id request (full replace for child collections).
AdminInteractions
Paginated feed of interactions rows. Filter by type. Manage notification recipients via a side panel calling /admin/interactions/recipients/*.
Future admin pages
Not yet implemented but in the schema:
- User management (currently goes through better-auth admin plugin endpoints —
/api/auth/admin/list-usersetc., not yet wrapped in a UI). - Stripe event log (
stripe_eventstable is queryable but no UI). - Audit log viewer (PostHog has it; could be embedded).
Add these as separate routes under /admin/* using the existing AdminLayout.
Adding a new admin route
- Add a route entry in
src/App.tsxinside the<AdminLayout>nested route. - Add a sidebar link in
AdminLayout.tsx. - Create the page under
src/pages/admin/. - Wrap data fetches with
RequirePlatformAdminif the page should fail closed.