Skip to main content

Admin Dashboard

Overview

The Admin Dashboard is the React/Express application in apps/admin-ui. It is the operator UI for runtime configuration, prompt workbench, model and agent management, SDAC prompt tuning, widget testing, content safety, Handbook RAG, Flow Map, changelog, and service health.

In APIM-backed testing environments, the supported browser entrypoint is:

https://test-aitools-llfc-apim.azure-api.net/dashboard/admin/

For Replit/local UI work, run the Admin UI locally and proxy API calls to the testing APIM route:

APIM_GATEWAY_URL=https://test-aitools-llfc-apim.azure-api.net
APIM_SUBSCRIPTION_KEY=<testing APIM subscription key>
MASTRA_APIM_SUBSCRIPTION_KEY=${APIM_SUBSCRIPTION_KEY}
MASTRA_RUNTIME_URL=https://test-aitools-llfc-apim.azure-api.net/dashboard/admin-api
VITE_MOCK_API=false
BASE_PATH=/admin/
PORT=8787
npm --prefix apps/admin-ui run dev

For layout-only work, use mock mode:

VITE_MOCK_API=true
BASE_PATH=/admin/
PORT=8787
npm --prefix apps/admin-ui run dev

Browser Routes

Source: apps/admin-ui/src/App.tsx.

RoutePurpose
/Main scoped dashboard.
/handbookRedirects to /?dashboardScope=handbook.
/prompt-workbenchFull prompt workbench route.
/evaluation-runsEvaluation run list/detail surface.
/widget-testingSDAC widget testing workflow.
/widget-embed-hostWidget iframe host used by tool sessions.
/mastra-studioEmbedded Mastra Studio launcher.
/internal-docsEmbedded internal docs.
/grafanaEmbedded Grafana view when enabled.
/flow-mapFlow Map browser.
/changelogScope-aware changelog page.

Dashboard scopes are source-defined in apps/admin-ui/src/pages/dashboard/dashboard-profile.ts:

  • core
  • sdac
  • k12
  • tap
  • handbook

Feature flags/build info control optional tabs such as Documentation, Grafana, Seed Agents, SDAC Prompt Tuning, Widget Testing, TAP Vector DB, Content Safety, Linear, Services, and Build Info.

API Routing Model

The browser calls same-origin /admin-api/* routes. Generated clients that start with /api/* are rewritten to /admin-api/* by apps/admin-ui/src/api-client/admin-auth.ts.

Local Vite live mode proxies /admin-api/* to MASTRA_RUNTIME_URL and strips the /admin-api prefix. In the recommended Replit live mode, MASTRA_RUNTIME_URL is the APIM dashboard admin API prefix:

https://test-aitools-llfc-apim.azure-api.net/dashboard/admin-api

The deployed dashboard Express server mounts:

PathSourcePurpose
/healthapps/admin-api/src/app.tsApp Service/dashboard health probe.
/adminapps/admin-api/src/app.tsStatic React app.
/admin-apiapps/admin-api/src/routes/admin/index.tsAdmin UI BFF routes.
/apps/admin-api/src/app.tsRedirects to /admin/.

BFF Route Groups

Source: apps/admin-api/src/routes/admin/index.ts.

GroupRoute examplesMutation class
Build info/admin/build-inforead-only
Feature flags/admin/feature-flags, /admin/feature-flags/:flagKeyread-only/admin mutation
Models/admin/model-capabilities*, /admin/llm-params*admin mutation
Agents/admin/agent-profiles*admin mutation
Prompt workbench/admin/prompt-workbench/*testing-safe/admin mutation; includes SSE
Evaluations/admin/evaluation-runs*testing-safe mutation
SDAC prompt tuning/admin/sdac/feedback/*, /admin/sdac/tune-prompt*testing-safe/admin mutation
Widget testing/admin/widget-token, /sdac/widget-token, /admin/tools/widget-testing/sessiontesting-safe mutation
Services/admin/services/health, /admin/health/detailedread-only
Tool sessions/admin/tools/*/sessiontesting-safe mutation
Content safety/admin/content-safety/analyzetesting-safe/provider call
Handbook RAG and policy review/admin/handbook/**mixed; cleanup/reset/rollback/promote/retire are destructive/admin; policy-review run/retry/resume are long-running review mutations
Flow map/admin/flow-map/*read-only
Linear/admin/linear/status, /admin/linear/verifyread-only/status verification
Changelog/admin/changelog?scope=read-only

See docs/internal/documentation-revival/endpoint-catalog.md for the broader route safety catalog.

Handbook Policy Review

The Handbook dashboard includes a one-page policy-review flow at:

/admin/?dashboardScope=handbook&dashboardTab=policy-review-flow

That flow lets reviewers choose a DB-registered MSBA policy set and indexed handbook, upload/prepare a handbook PDF, start an async review, watch progress, inspect policy findings, inspect checklist flags, record reviewer actions and quality feedback, and export the report. The detailed findings queue remains available at dashboardTab=policy-review.

Source-backed BFF routes after the /admin-api mount are:

MethodPathPurpose
GET/admin/handbook/policy-reviewDashboard projection with artifact options, selected sources, active job, saved runs, run detail, findings, checklist review, usage summary, and diagnostics.
POST/admin/handbook/policy-review/runStart a review for selected policy/handbook artifacts.
POST/admin/handbook/policy-review/retryRetry a failed review job.
POST/admin/handbook/policy-review/resumeResume/view a saved review run by runId.
POST/admin/handbook/policy-review/findings/:findingId/actionsRecord reviewer workflow action.
POST/admin/handbook/policy-review/findings/:findingId/feedbackRecord evidence, reasoning, and outcome quality feedback.
POST/admin/handbook/rag-presets/pdf-jobsPrepare uploaded PDFs for RAG or Review Flow; send preparationMode: "reviewable-unit-v2" or policyReviewPreparation: true for policy review.

The same run now includes the MSBA Student Handbook Checklist 2025 pass. The checklist result is exposed on runDetail.checklistReview, including expected/evaluated item counts, satisfied/missing counts, warning count, coverage score, checklist score, and item-level evidence refs where available.

Authentication

The current APIM/dashboard model has three distinct boundaries:

  1. Browser to dashboard: use the APIM dashboard route.
  2. Browser to /admin-api/*: include Ocp-Apim-Subscription-Key.
  3. Dashboard/APIM to runtime /admin/*: APIM/dashboard forwards the upstream admin proxy secret; browser code should not call runtime /admin/* directly.

The Admin UI accepts subscription-key and subscription_key URL parameters and persists the key in browser session storage for same-origin API calls.

Runtime /admin/* routes are protected by packages/platform-runtime/src/server/routes/shared/admin-proxy-guard.ts when APIM or an admin proxy secret is configured. That guard only wraps /admin/*; routes such as /docs/chat, /health, /setup/db*, generic tool execution, and domain routes have separate route/deployment policies.

The dashboard widget-testing flow can mint widget tokens server-side. Replit should use that flow instead of receiving widget OAuth client credentials.

Replit Guidance

  • Use mock mode for visual layout and interaction polish.
  • Use live APIM mode for screens that depend on deployed feature flags, service health, widget token/session generation, prompt workbench runs, or real BFF responses.
  • Do not provide full backend .env files to shared Replit workspaces.
  • Do not call routes labeled destructive or never call from Replit in the endpoint catalog.
  • Send backend/API/infra/database gaps back to the normal engineering workflow.

Source Code

PathDescription
apps/admin-ui/src/App.tsxBrowser route table.
apps/admin-ui/src/pages/dashboard/dashboard-profile.tsScopes, tabs, and feature-gated IA.
apps/admin-ui/src/api-client/admin-auth.tsAPIM key persistence and /api to /admin-api rewriting.
apps/admin-ui/src/api-client/custom-fetch.tsGenerated client fetch adapter.
apps/admin-ui/vite.config.tsMock/live mode and local proxy behavior.
apps/admin-api/src/app.tsExpress app routes and static shell.
apps/admin-api/src/auth/admin-access-context.tsDashboard entrypoint/auth and runtime header resolution.
apps/admin-api/src/lib/proxy.tsRuntime proxy, SSE proxy, download proxy, and mock fallback helpers.
apps/admin-api/src/routes/admin/**Admin UI BFF modules.
packages/platform-runtime/src/server/routes/index.tsRuntime admin route aggregate.
packages/platform-runtime/src/server/routes/shared/admin-proxy-guard.tsRuntime admin proxy guard.

Validation

Recommended local checks after Admin UI docs or API contract changes:

npm --prefix apps/admin-ui run typecheck
npm --prefix apps/admin-ui run build
npm --prefix apps/admin-ui run test:e2e

For deployed smoke, use APIM /dashboard/admin/ and at least one read-only /dashboard/admin-api/* request with the testing APIM subscription key.