Skip to main content

Admin / Super-Admin Portal

Audience: Internal ops, super-admins, support, finance, engineering · Where in app: /admin/... · Access: Super-admin only — a logged-in user whose user_type === 'admin'.

The Admin (a.k.a. Super-Admin) portal is the internal control panel for the Knock Knock platform. It is not the customer dashboard — it is the staff-only surface for managing every company and user, reading revenue, watching AI spend, curating the Nox knowledge base, debugging the identity graph, managing packages/add-ons, moderating abuse, and inspecting logs. It is a single Vue app section mounted under /admin, gated by user type, and it talks to the main backend, the AI microservice (ms-ai), and other services.

What it does

  • Gives staff a god-mode view of all tenants: every company, user, agency, subscription, invoice, and AI usage record across the whole fleet — not scoped to one tenant the way the normal dashboard is.
  • Surfaces money: revenue/MRR/ARR reporting (see revenue.md) and AI provider spend / cost-tracking (see cost-tracking.md).
  • Lets staff act: edit companies/users, impersonate ("login as") a user, toggle feature flags, grant manual AI credits, block abusive IPs/URLs/companies, send broadcast notifications, and curate Nox knowledge.
  • Provides deep debugging surfaces for the identity graph, API request logs, email logs, webhook events, and call recordings.

How it works

The portal is defined entirely in the frontend router at frontend/src/router/admin.js. Every route lives as a child of one parent route:

{
path: '/admin',
component: AdminLayout.vue,
meta: { requiresAuth: true, allowedUserType: USER_TYPE.ADMIN },
children: [ ... all admin screens ... ]
}
  • Access control. The parent route sets meta.allowedUserType: USER_TYPE.ADMIN. USER_TYPE.ADMIN === 'admin' (frontend/src/common/constants/user.js). A global router guard enforces this; anyone who is not an admin user is bounced. There is no finer-grained per-screen permission inside the portal — if you are admin, you see everything.
  • Backend enforcement (defense in depth). Frontend gating is cosmetic; the backend re-checks on every request. The main-backend revenue endpoints call _ensureAdmin() which returns 403 unless request.user.user_type === 'admin' (backend/app/controllers/AdminRevenueController.js). The AI-microservice admin endpoints are gated by AdminOnlyGuard (ms-ai/src/auth/admin-only.guard.ts) on the AdminCostTrackingController.
  • Layout & navigation. All screens render inside frontend/src/layouts/AdminLayout.vue. Navigation (the sidebar) is wired separately from the route table.
  • Cross-service. Most screens call the main backend (axios with a relative path like /company, /user, /admin/revenue/...). Cost-tracking screens call ms-ai via config.getAiApiUrl() (/api/cost-tracking/admin/...).

Screens & fields

Every admin screen, grouped by area. Routes are children of /admin. Pages marked (part 2) are documented in a sibling cluster but linked here for completeness.

Revenue

RouteNamePurpose
/admin/revenueRevenueSubscription revenue, MRR/ARR, top customers, recent paid invoices, plus invoice-repair maintenance. See revenue.md.

Cost-Tracking (AI spend)

RouteNamePurpose
/admin/cost-trackingSpend OverviewFleet-wide USD + credits by provider/agent, unit economics, reconciliation, missing-price charges. See cost-tracking.md.
/admin/cost-tracking/companiesCompany SpendPer-company spend leaderboard + drill-down by agent/model.
/admin/cost-tracking/modelsModels & PricesProvider/model catalog and per-unit USD rate card.
/admin/cost-tracking/elevenlabs-plansElevenLabs PlansCredit-based plan tier rates + live ElevenLabs subscription state.
/admin/cost-tracking/scrapingbeeScrapingBeeLive ScrapingBee account state, credit usage, ledger drift.

Identity (part 2)

RouteNamePurpose
/admin/identity/personsPersonsBrowse identity-graph person records. See ../subsystems/identity-graph.md.
/admin/identity/persons/:idPerson DetailOne person's merged profile + evidence.
/admin/identity/persons/:id/profiles/:company_idPerson Profile DetailA person's per-company profile.
/admin/identity/profilesPerson ProfilesBrowse all per-company person profiles.
/admin/identity/form-submissionsForm SubmissionsRaw form-intercept submissions feeding the graph.
/admin/identity/reconcile-conflictsCRM ReconcileConflicts between graph data and CRM.
/admin/identity/maintenanceIdentity MaintenanceOne-off identity-graph maintenance jobs.
/admin/identity/configIdentity Graph ConfigTunable identity-resolution thresholds/flags.

Knox / Nox (part 2)

RouteNamePurpose
/admin/knoxNox KnowledgeKnowledge-base document management. See ../subsystems/nox-assistant.md.
/admin/knox/doc/new, /admin/knox/doc/:idKnowledge Document EditorCreate/edit a knowledge document.
/admin/knox/pages, .../pages/create, .../pages/:id/editNox Page RegistryRegister pages Nox can navigate/answer about.
/admin/knox/modelsNox AI ModelsModel selection for Nox.
/admin/knox/conversationsNox ConversationsInspect Nox conversation transcripts.
/admin/knox/feedbackNox FeedbackUser feedback on Nox answers.
/admin/knox/voice-toolsNox Voice ToolsVoice-tool config for Nox.
/admin/knox/visitor-watchesVisitor WatchesKnox visitor-watch records.

Companies / Users (this cluster)

RouteNamePurpose
/admin/companiesCompaniesList/search every company. See companies-users.md.
/admin/companies/:idCompany DetailsOne company's profile, flags, subscription.
/admin/companies/:id/editEdit CompanyEdit company fields + feature toggles.
/admin/companies/:id/ai-credit-logsAI Credit LogsAudit trail of AI-credit changes for the company.
/admin/companies/:id/ai-credits-usageAI UsageDetailed per-company AI usage breakdown.
/admin/usersUsersList/search every user; impersonate. See companies-users.md.
/admin/users/:idUser DetailsOne user's profile + AI credit logs.
/admin/users/:id/editEdit UserEdit user fields.

Agencies (part 2)

RouteNamePurpose
/admin/agencies, /admin/agencies/:id, .../create, .../:id/editAgenciesAgency (white-label reseller) management.
/admin/agency-conversion-requestsAgency Conversion RequestsRequests to convert a direct account into an agency.
/admin/agency-invites, .../create, .../:id/editAgency InvitesManage agency invitations.

Packages / Add-ons (part 2)

RouteNamePurpose
/admin/packages, .../create, .../:id/editPackagesDirect subscription plans (pricing, AI credits).
/admin/addons, .../create, .../:id/editAddonsPurchasable add-ons.
/admin/agency-packages, .../create, .../:id/editAgency PackagesPlans sold to agencies.
/admin/agency-addons, .../create, .../:id/editAgency AddonsAdd-ons sold to agencies.

Moderation

RouteNamePurpose
/admin/blocked, .../create, .../:id/editBlocked ListBlock IPs, URLs, and companies. See companies-users.md.

Media (part 2)

RouteNamePurpose
/admin/default-videosDefault VideosDefault knock/widget videos.
/admin/call-backgroundsCall BackgroundsBackground images for calls.
/admin/call-recordingsCall RecordingsInbound/outbound/forwarded/AI call recordings. See ../subsystems/session-recording.md.

Logs / Ops (part 2)

RouteNamePurpose
/admin/logsSystem LogsPlatform/system log viewer.
/admin/api-request-logs, .../:idAPI Request LogsInbound API request audit + detail.
/admin/email-logs, .../:idEmail LogsOutbound email audit + detail.
/admin/webhook-eventsWebhook EventsIncoming/outgoing webhook event log.
/admin/notificationsSend NotificationsBroadcast notifications to users.
/admin/playground, .../:idPlaygroundInternal experimentation surface.
/admin/settingsAdmin SettingsPortal-level settings.

Dashboard

RouteNamePurpose
/adminAdmin DashboardLanding page for the portal (frontend/src/views/admin/Dashboard.vue).

Behaviors & edge cases

  • No partial admin. There is a single admin user type; there is no read-only vs read-write split inside the portal. Treat admin access as fully privileged.
  • agency user type ≠ admin. USER_TYPE.AGENCY and AGENCY_STAFF exist but are not admin; they do not unlock /admin. The constants file explicitly warns AGENCY "should NOT be used."
  • Frontend gate is not security. Hiding a button does not protect data. Every sensitive action is independently checked on the backend (_ensureAdmin, AdminOnlyGuard). If you find an admin endpoint that is not guarded, treat it as a security bug.
  • Cross-service auth. Cost-tracking pages send the same JWT to ms-ai; AdminOnlyGuard reads req.user from the JWT. Note from the controller: do not add @AuthType('secret') to these routes — it bypasses the JWT and leaves them unguarded.

Technical implementation

  • Route table: frontend/src/router/admin.js
  • Layout: frontend/src/layouts/AdminLayout.vue
  • User-type constants: frontend/src/common/constants/user.js (USER_TYPE.ADMIN === 'admin')
  • Views: frontend/src/views/admin/**
  • Repositories (API clients): frontend/src/repositories/admin/**
  • Backend admin controllers: backend/app/controllers/Admin*Controller.js and routes backend/app/routes/admin*Routes.js
  • AI-microservice admin: ms-ai/src/cost-tracking/controllers/admin-cost-tracking.controller.ts, guard ms-ai/src/auth/admin-only.guard.ts
  • Related services: ../services/frontend.md, ../services/backend.md, ../services/ms-ai.md