# Admin Overview

> The platform admin area (/admin): what it shows, who can open it, what an admin can and can't do, and where each rule lives.

*Canonical: https://makerkit.dev/docs/void-cloudflare/admin/overview*

---

`/admin` is the platform admin for you and your staff: platform counts, users (search, ban, roles, sessions, impersonation), organizations, background jobs and the audit log. It is separate from [organization roles](../members-management/roles-permissions): an admin is a user whose `user.role` is an admin role, set in the database, never by a sign-up or a setting.

{% img src="/assets/images/docs/void-cloudflare/admin-dashboard.png" width="1440" height="900" alt="The platform admin dashboard with synthetic users, organizations and job counts." /%}

The platform admin dashboard with synthetic users, organizations and job counts.

## Pages

The dashboard groups total users, organizations and active subscriptions in one panel. A second panel shows new users over the last 7 and 30 days. Banned users remain a Users filter. The Jobs health panel summarizes dead work and links to the jobs list.

| Page | Path | Statement it needs |
|---|---|---|
| Dashboard | `/admin` | `dashboard:view` |
| Users | `/admin/users` | `user:list` |
| User | `/admin/users/<id>` | `user:get` |
| Organizations | `/admin/organizations` | `organizations:list` |
| Organization | `/admin/organizations/<id>` | `organizations:view` |
| Jobs | `/admin/jobs` | `outbox:list` |
| Job | `/admin/jobs/<id>` | `outbox:get` |
| Audit log | `/admin/audit` | `audit:list` |

Users and Organizations are searchable, newest first by default, with 25 rows per page (up to 100). They support global Name/Created sorting, plus Email for Users and Slug for Organizations. Sort, direction, page size, filters and page live in the URL; changing sort or page size returns to page one. The statements and the roles that hold them are in [RBAC permissions](./rbac-permissions).

The organizations list and detail page show a plan as the app names it: the billing product's name in the admin's language, with the interval (for example "Starter · Billed monthly") when the product has plans with different intervals. A plan the billing config no longer has shows as stored, and the detail page always adds billing's own plan name for support. Labels match the stored plan name exactly, so a renamed plan shows as stored until Stripe's next event rewrites the row.

## Inspect an Organization

Open **Organizations** to search workspaces by name or slug. Select an organization to inspect its members and billing summary, or follow its audit log and jobs links when your role permits them.

{% img src="/assets/images/docs/void-cloudflare/admin-organizations.png" width="1440" height="900" alt="The admin organizations directory with synthetic workspaces." /%}

{% img src="/assets/images/docs/void-cloudflare/admin-organization.png" width="1440" height="900" alt="The Acme Studio organization detail with its members." /%}

## What an Admin Can Do

- **Ban and unban** a user (a ban also signs them out everywhere and blocks sign-in).
- **Change a user's admin role**, with a [step-up code](../authentication/step-up-codes). Never your own, and the last admin can't be demoted.
- **Sign out** one session or all of a user's sessions.
- **[Impersonate](./impersonation)** a user, with a step-up code, to see the app as they do.
- **Replay or cancel a background job**, with a step-up code ([Jobs](#jobs)).

Ban, unban and sign-out never target yourself or an account holding an admin role: to act on an admin, change their role first.

It can't create or delete users or organizations, set a password or an email, or edit organization data, billing or subscriptions. Those actions aren't in the pages.

## Who Gets In

Every refusal answers the app's own 404, so the area looks like a missing page to anyone it isn't for: signed-out visitors, normal users, organization admins, banned users, an admin while impersonating, and an admin whose role lacks the page's statement.

Two layers check it:

1. `middleware/12.admin.ts` only gates **navigation** to `/admin`.
2. Every admin loader and action calls `requireAdmin({ c, statement })` itself. A direct `POST` to an action skips the middleware, so the action's own check is the one that counts. See [Adding an admin page](./adding-admin-pages).

The first admin is made on the command line: [Granting the first admin](./first-admin). Two-factor for admins: [Admin two-factor](./admin-two-factor). An optional second lock in front of `/admin`: [Cloudflare Access](./cloudflare-access).

## Audit Log

An admin who holds `audit:list` explores the audit log on its own page (`/admin/audit`): every event, or one user's or organization's, by date, 50 at a time. A user's or organization's page links to it, filtered to them (**View audit log**). It reads through Cloudflare's Analytics SQL binding (no secrets to set): see [Read the audit log in the admin](../audit/reading-the-log).

## Logs

Ban, unban, role change, session sign-out and impersonation start and stop are structured logs (`admin.user_banned`, `admin.user_unbanned`, `admin.role_changed`, `admin.sessions_revoked`, `admin.impersonation_started`, `admin.impersonation_stopped`) with ids only: the acting admin, the target and, during impersonation, both. A refused signed-in visitor is logged as `admin.access_denied`. No emails, tokens or payloads.

The same actions are also recorded in the [audit log](../audit/overview) (`kit.admin.*`: kept 90 days, best effort), with the admin as the actor and the user as the target. They record what the admin did: an unban of a user who was not banned, or a role set to the role the user already had, is recorded too.

## Where Things Live

| What | Where |
|---|---|
| Admin roles and permissions | `packages/rbac/src/admin-rbac.config.ts` |
| `requireAdminTwoFactor` | `apps/web/config/admin.config.ts` |
| Pages | `apps/web/pages/admin/` |
| Services (list, ban, roles, sessions) | `@kit/admin` |
| Admin copy | `admin.server.json` (server-only: resolved in loaders, never sent to the browser) |
| Better Auth's admin plugin | `@kit/better-auth` `adminPlugin()`; its own `/admin/*` HTTP endpoints answer 404 (`adminScope`) |

## Jobs

`/admin/jobs` lists background work newest first. The default status is **All**, with 50 rows per page. Search by kind in the toolbar; use **Add filter** for an organization or UTC creation range (both selected days included). Click the status chip to change it; click any chip to edit it or its × to remove it. **Clear filters** restores **All** statuses; **Older jobs** keeps those filters. Creation order can switch between newest and oldest first; changing it restarts pagination. Ascending pages link to newer jobs. Requires `outbox:list`; invalid filters and read failures stay in the jobs section.

Open a job with `outbox:get` to see its attempt history, last error, terminal reason and text-only metadata. Payloads are never displayed. **Keep job metadata ids-only:** detail shows it as stored, so never put names, email addresses, tokens or request bodies there. Diagnostic text is capped at 10,000 characters and rendered as text, never HTML. Missing or retained-away jobs answer 404; a database failure shows a failed state.

With `outbox:replay`, dead or cancelled jobs can be replayed after confirmation and an emailed step-up code scoped to the admin and job. Replaying twice is refused by the atomic library transition. Successful replays record `kit.admin.outbox_job_replayed` after commit.

With `outbox:cancel`, pending/retrying jobs can be cancelled using their own step-up code. Codes are scoped to the acting admin, job and action; a replay code cannot cancel a job. The code-request cooldown applies across actions, so a recent replay confirmation can make cancellation ask you to wait. Processing jobs are refused as in flight; terminal jobs are unchanged. Success records `kit.admin.outbox_job_cancelled`.

Replay/cancel audit events contain only job id and kind; tenant jobs use organization scope, system jobs use the acting admin’s user scope. Raw diagnostics and metadata are never logged or audited.

Organization detail includes **View jobs** only with `outbox:list`; it opens the organization filter across all statuses.

The dashboard jobs tile requires `outbox:list`. It counts jobs that finished dead in the last seven days and shows backlog severity as text and colour. A failed read hides the tile without blocking other dashboard counts.


## Shared Table Filters

Jobs and Audit use `@kit/ui/table-filters`: a search strip, dashed **Add filter** button, editable chips and **Clear filters**. Selections update the URL and reset pagination immediately. Date ranges offer Today, Last 7 days, Last 30 days and a custom UTC calendar range.

Organization choices search names/slugs; Audit also searches users by name/email. Choosing a user replaces the organization filter and vice versa. Discovery requires the corresponding `user:list` or `organizations:list` permission, independently of Jobs/Audit access. A bookmarked selection without directory access, a deleted subject or unavailable lookup uses **Selected user/organization** and remains removable; it never reveals an inaccessible name.

Kit consumers can use the same toolbar with their own tables and data. See [Table filters](../development-guide/shared-utilities#table-filters) for the public API and a shadcn Table example. No admin, database or router dependency is required.


## Table Controls

Users, Organizations, Jobs and Audit share the kit's shadcn table frame. **Columns** searches column names, shows/hides optional columns, pins them to either edge and resets presentation. Preferences remember only column IDs for that admin/table; storage failures fall back safely. Sticky headings stay in view within the table's own scroll region. Horizontal pinning pauses on narrow screens so all columns remain reachable.

Sortable headers and **Sort** operate on the complete server result set. Users support Name, Email and Joined; Organizations support Name, Slug and Created; Jobs supports creation order. Audit remains newest first. Users/Organizations offer bounded rows-per-page choices and real ranges/counts. Jobs/Audit show rows on the current cursor page and a first-page link without fabricated totals.

Cells provide readable status badges, exact UTC date descriptions, copyable IDs and full-value previews. Authorized entity links remain explicit. There is no row selection, row action menu, saved view or inline editing.
