Slice · AI prompt
Access-gated admin in 2 variants — a minimal generic shell, or the composed 26-section console that mounts your other slices. Each pulls only its own backend.
# Install `admin` — Admin — generic shell + composed console
> Access-gated admin in 2 variants — a minimal generic shell, or the composed 26-section console that mounts your other slices. Each pulls only its own backend.
📚 Knowledge base : https://resource.rahmanef.com/llms.txt
📦 Slice detail : https://resource.rahmanef.com/slices/admin
🧠 JSON catalog : https://resource.rahmanef.com/api/knowledge?slice=admin
🔗 Source : https://github.com/rahmanef63/resource-site/tree/main/frontend/slices/admin
## 1. Install
```bash
npx rahman-resources add admin
# alias: npx rr add admin
```
The CLI copies `frontend/slices/admin/` into your project + augments `.env.example` + installs npm deps automatically. Run it from your project root.
## 2. What it ships
- shadcn primitives: `badge`, `button`, `card`, `input`, `progress`, `scroll-area`, `select`, `sheet`, `table`, `textarea`
- peer slices (cascade install):
- `convex-auth` — requireAdmin gate uses convex-auth identity.
- `rbac-roles` — console section gates are permission tokens resolved by rbac-roles.
- env vars:
- `SUPER_ADMIN_EMAIL` (convex) — shell variant — single super-admin gate.
- `PLATFORM_ADMIN_EMAILS` (convex) — console variant — comma-separated platform-admin allowlist.
- convex feature paths: `convex/features/admin`, `convex/features/admin_console`
## 3. Wire it up
Run `npx rr add admin` for both, or `npx rr add admin shell` / `console` for one — each variant pulls only its own convex backend. shell: mount <AdminPage labels={...} /> + call buildAdminStats({ sliceRegistry, queryTable }) in convex/features/admin/query.ts; lock down with SUPER_ADMIN_EMAIL. console: mount <AdminConsole access={useAdminAccess()} components={{ users: <UsersPanel/>, ... }} /> — owned sections (analytics/audit-log/nav-config/seo-health/leads) render as-is, map each reuse section id to the panel from the peer slice you installed; compose adminConsoleTables into convex/schema.ts and front ac_leads.create with rate-limit; gate via PLATFORM_ADMIN_EMAILS.
## Rules of engagement
- shadcn-only UI primitives. No raw `<button>` / `<dialog>` / native date or file inputs.
- 200-line hard cap per source file (extract neighbours when over).
- All Convex queries hit an index (`.withIndex(...)`); never bare `.collect()`.
- Public mutations/queries declare `args:` validators + authz.
- Full ruleset: https://resource.rahmanef.com/best-practice
The agent will fetch /llms.txt for the full ruleset and use /api/knowledge for the JSON catalog.