ui-admin-application — React Tenant Admin Panel

By Engineering Team•October 10, 2026•5 min read

Responsibility

ui-admin-application is the operator-facing counterpart to ui-application — tenant admins and staff manage catalog, inventory, pricing, shipment configuration, and mobile-app content through this panel rather than any direct backend access. Like the shopper app, it holds no independent business logic beyond orchestrating calls to the services that own each decision.

  • Feature Triad (5-file) — every feature directory is exactly <Feature>Types.ts (interfaces, no logic) → <Feature>Repository.ts (the only file importing apiClient, one file per microservice boundary) → <Feature>Service.ts (pure data-mapping functions, no React) → <Feature>Controller.ts (a custom hook doing state orchestration, reads authStore once) → <Feature>Page.tsx (stateless JSX). A multi-level feature (e.g. Category) may share Types/Repository/Service across sub-pages while each sub-level gets its own Controller/Page pair.
  • Wizard/Multi-Step pattern — stockEntry and mobileAppConfig are the canonical references for any feature needing a guided multi-step flow (step ownership of state, StepIndicator/StepConnector, section title bar, footer navigation).
  • Multi-tenancy — TenantID comes from the Firebase JWT only, flowing one direction: authStore → controller → service argument → repository argument → apiClient header. It is never injected inside apiClient.ts itself, never read from authStore inside a repository or service, and never passed as a prop through a component tree.
  • HTTP & error handling — apiClient.ts is the single Axios instance for every backend call; its interceptors attach Authorization/X-Tenant-ID/X-Firebase-AppCheck, map HTTP errors to a typed AppError, and on a 401 clear authStore and redirect to /login.
  • Global state boundary — Zustand’s authStore is the only cross-feature global state in the app; no Redux or Context is used for feature-local state.
  • Observability — initTracing(otelEndpoint?, apiBaseUrl?), called once in main.tsx, wires XMLHttpRequestInstrumentation with propagateTraceHeaderCorsUrls; traceparent is injected by the instrumentation itself, X-Correlation-ID is minted per-request via crypto.randomUUID() — X-Tenant-ID is deliberately not injected at this layer. startUploadSpan tracks upload lifecycles, delegated from features/media/MediaService.ts.
  • Firebase App Check — ReCaptchaV3Provider in non-DEV builds; import.meta.env.DEV skips initializeAppCheck entirely and the interceptor instead sends VITE_FIREBASE_APPCHECK_DEBUG_TOKEN directly, matching ui-application’s and user-secure-engine’s debug token; see [[06-security]] for the cross-service mismatch hazard.

Tech Stack

Concern Choice
Language / framework TypeScript (strict) / React 18 + Vite
UI library MUI v6
Global state Zustand (authStore only)
Networking Axios, single instance (apiClient.ts)
Routing React Router v6, lazy-loaded via React.lazy
Logging loglevel, structured debug/warn/error convention

Implementation Notes

  • Page-level screenshot walkthroughs for this app’s screens (category master, mobile-app-configure, package master, product catalog, stock entry, tenant master, warehouse master) live under this application’s 07-ui-admin doc section, one hub doc per feature area.
  • This app never sends X-Tenant-ID from a hardcoded or client-chosen value — it is always sourced from the authenticated authStore state populated after Firebase sign-in, consistent with [[06-security]]‘s header contract.

Full module reference: ui-admin-application/CLAUDE.md.