God mode (admin overview)
What "god mode" is, who gets in, and the operator surfaces behind it — tenants, licensing, billing, white-label, and the audit trail — with the RBAC and session model that gates every page.
God mode (admin overview)
"God mode" is the operator side of HostSSH — the control-plane dashboard that
platform operators use to run the whole fleet, not the surface a customer
sees. It lives under the (god) route group in the control-plane web app, and
everything inside it is gated: an authenticated customer who lands there is
bounced straight to /welcome, so end users never see operator data.
This section documents the account-and-money surfaces an operator works with day to day:
| Page | What it does |
|---|---|
| Tenants | Customer orgs — direct, resellers, and reseller sub-accounts — with tier, status, servers, MRR, and statements |
| Licensing (admin) | Issue, seat, and revoke the ed25519 license keys agents authenticate with |
| Billing | Plan catalog, subscriptions, invoices, and dunning — MRR derived from the catalog |
| White-label | Per-brand custom domains, accent theming, and powered-by suppression |
| Audit log | The append-only trail of privileged operator actions |
These five sit alongside the rest of god mode — Fleet, Slots, Mesh, Deploy, Images, Recovery, Provisioning, DNS Tools, Access, Observability, Support, Users, Identity, and Settings — which are documented elsewhere.
Who gets in
The (god) layout runs requireSession() on every request and then checks
isAdmin(session.admin). Only an admin clears that check; a customer session
is redirected to /welcome. There is no "sort of admin" — you either resolve to
an admin identity or you don't see the control plane at all.
Admins come in two shapes:
| Role | How it's granted | What it can do |
|---|---|---|
super_admin (root) | The seeded root operator (root: true) | Everything — holds ALL_PERMISSIONS, and root is re-derived every request so it can't be edited away |
admin (sub-admin) | Created in Identity, granted a subset of permissions | Only the pages its granted permissions unlock |
The seeded root operator is Sevak Girard (ROOT_ADMIN in lib/session.ts),
whose email is read from ROOT_ADMIN_EMAIL. Root's privilege is not stored as a
grant list — effectiveAdminRole() returns super_admin whenever root is
true, so a root operator always has the full catalog regardless of what's in the
database.
How every page is gated (RBAC)
Permissions are a flat catalog defined in lib/rbac.ts (PERMISSIONS). Each
control-plane page calls guard('<permission>'), which returns the session plus
an allowed boolean; when allowed is false the page renders a LockedState
explaining which privilege is missing instead of the real content. The server
actions behind each page re-check the same permission with
userHasPermission(), so a locked page can't be worked around by calling the
action directly.
The permissions that matter for this section:
| Permission | Unlocks |
|---|---|
tenants.manage | Tenants — create/edit/delete orgs, send statements |
licenses.manage | Licensing — issue and revoke keys |
profitability.view | Billing (the Billing page guards on this) and Profitability |
white_label.manage | White-label — brands and domains |
audit.view | Audit log |
Two permissions are super-admin only and can never be granted to a
sub-admin, even explicitly: admin.manage_admins and hardware.manage
(SUPER_ONLY in lib/rbac.ts). The catalog is fail-closed: a role of
none gets nothing, and a sub-admin gets only what's in its granted set.
The sidebar honors the same rules — visibleNavKeys() hides any nav item whose
permission the current admin lacks, and hides godOnly items entirely unless
the launch mode is god.
Session context: launch mode, impersonation, simulation
Beyond the authenticated admin, three pieces of control-plane state ride their
own cookies and layer on top of the session (lib/session.ts):
| Context | Cookie | Purpose |
|---|---|---|
Launch mode (god / beta / production) | hs_launch | Gates godOnly nav and is stamped onto every audit event |
| Impersonation | hs_imp | Act as another identity in a full session — requires admin.impersonate; shows a banner |
| Simulation | hs_sim | Preview a tier or tenant without acting as anyone — requires admin.simulate |
Impersonation and simulation are privileged in their own right (they require
admin.impersonate / admin.simulate), and when an operator acts on behalf of
someone under impersonation, that onBehalfOf identity is captured on each
audit entry.
Demo data vs. persisted
Every store in this section is dual-backend: it uses Postgres when
DATABASE_URL is set, and an in-memory seeded mock otherwise. Pages that read a
mutable store surface which backend they're on with a badge — persisted
(real DB) or demo data (seeded, in-memory, resets on restart). When you see
demo data, the rows on screen are the seed set, not live customers. Each page
below calls out where this badge appears.
Where to go next
- Managing customer orgs and their billing status → Tenants
- Minting and revoking the keys agents run on → Licensing (admin)
- The customer-facing side of the same license model → Licensing, seats & transfers
- Plans, invoices, and dunning → Billing
- Reseller brands and custom domains → White-label
- Reviewing who did what → Audit log