Web Console Overview
The TkushPatch Web Administration Console (ota-web-console) is a Next.js 15 application (App Router, React 19, TypeScript) acting as the graphical Control Plane to manage mobile release lifecycles, OTA patches (compressed binary diff), rollout strategies, RBAC governance, and fleet observability.
Architecture and Tech Stack
The web console acts both as an operator user interface and as a BFF (Backend-For-Frontend) gateway to the TkushPatch Server server (ota-server, port 8080 by default via the OTA_BACKEND_URL environment variable).
| Layer | Technology / Component | Primary Role |
|---|---|---|
| UI Framework | Next.js 15 (src/app/) | App Router navigation, Server/Client Components, and proxy API routes (src/app/api/) |
| Authentication | AuthProvider (src/lib/auth/AuthContext.tsx) | Operator session (localStorage + HTTP cookies), inactivity lock (IdleTimer) |
| Access Control | middleware.ts & RoleGuard.tsx | 5-role RBAC enforcement across routes and action buttons |
| Project Context | ProjectProvider (src/lib/project/ProjectContext.tsx) | Active application state (selectedAppId) and automatic release discovery |
| Visual Theme | ThemeProvider (src/components/layout/ThemeProvider.tsx) | Dynamic toggle between light (light) and dark (dark) themes |
| Internationalization | I18nProvider (src/lib/i18n/I18nProvider.tsx) | Instant client-side French (fr) / English (en) translation |
Layout Structure (AppLayoutShell)
All authenticated pages are wrapped inside the AppLayoutShell component (src/components/layout/AppLayoutShell.tsx), which orchestrates the global layout (excluding public routes /login, /register, /forgot-password, and /cli/login):
- Top Header: Organization switcher, system alerts, theme toggle (dark/light), and user account profile.
- Sidebar: Quick navigation across Applications, Releases, Patches, Approvals, Fleet Devices, and Settings.
- Main Viewport: Operational dashboards, live rollout charts, and management action controls.
Sidebar (Sidebar) and Navigation
The Sidebar component (src/components/layout/Sidebar.tsx) dynamically filters visible menu items according to the signed-in operator's RBAC role using the hasAccessToRoute(role, href) function defined in src/lib/auth/roles.ts.
Menu items are grouped into three main sections:
1. Operations and Deployment
- Applications (
/apps): Catalog of all mobile applications in the organization and project creation wizard. - Overview (
/): Global executive dashboard (fleet KPIs, latest releases, recent audit events). - Releases & Patches (
/releases): Consolidated master registry of all binary versions and patch publication modal. - Store Catalog (
/catalog): Store version governance (Apple App Store / Google Play) andIN_STORE_REVIEWshield. - Rollout & Geo (
/rollout): Progressive Canary control (0%to100%), ISO-3166-1 country targeting, and network/criticality strategies. - Approvals (4-Eyes) (
/approvals):STAGEDquarantine queue and digital signature cryptographic signing (APPROVED_AND_SIGNED). - Dynamic Assets (
/assets): Over-the-air CDN management for images, banners, and JSON configuration bundles.
2. Observability and Support
- Crashes & Symbols (
/symbols): Storage for\.symbolsDart/C++ files and interactive stacktrace deobfuscation console. - Mobile Telemetry (
/telemetry): Real-time stream of SDK events (patch_install_success,patch_install_failure) and automatic Circuit-Breaker status. - Customer Support (L2/L3) (
/support):#8CARshort support code lookup, device diagnostics, QA Whitelist (isWhitelistedQA), and rollback acknowledgment.
3. Governance and Security
- Teams & Access (
/teams): Collaborator management, SMTP invitations, and 5-role RBAC assignment. - Security Policies (
/policies): Configuration of the Four-Eyes principle, Anti-Bomb quotas, HMAC expiration, and TLS certificate pins. - Audit Trail (
/audit): Immutable traceability log with CSV export and signed PDF report generation. - System Health (
/health): cryptographic signing engine /local-rsastatus, disk usage, L1/L2 cache metrics, and Day-2 deprecated artifact purge. - My Account (
/account): Personal operator profile, visual preferences, and organization indicators.
Header (Header) and Breadcrumbs (HeaderBreadcrumb)
The top header (src/components/layout/Header.tsx) provides cross-cutting controls:
- Dynamic Breadcrumbs (
HeaderBreadcrumb.tsx): Displays the exact hierarchical path (e.g.,Organization > Applications > com.sara.money > Releases > 3.28.5+99) with quick navigation links. - Application Selector (
ProjectSwitcher.tsx): Allows switching between mobile applications instantaneously or opening theCreateProjectModal. - Quick Search Bar: Filters versions, application identifiers (
app_id), or patch numbers. - Backend Status Indicator: Real-time badge showing connectivity to the TkushPatch backend and signing engine.
- Locale and Theme Switchers: Direct toggle buttons for language (
FR/EN) and theme (Light/Dark).
Project Switcher (ProjectSwitcher & ProjectContext)
The ProjectSwitcher component (src/components/layout/ProjectSwitcher.tsx) relies on ProjectContext (src/lib/project/ProjectContext.tsx) to maintain the organization's application list:
- Local Persistence: Projects are stored in
localStorageundertks_projects_registryand the currently selected application undertks_selected_app_id. - Backend Auto-Discovery: On startup,
ProjectContextqueries/api/admin/v1/releases?tenant_id=...and automatically merges anyappIdfound on the server into the local project registry. - Contextual Routing: When an operator views a sub-page under
/apps/[appId]/*and switches applications in theProjectSwitcher, the URL automatically navigates to the corresponding tab of the newly selected application.
Light / Dark Theme (ThemeProvider)
The ThemeProvider component (src/components/layout/ThemeProvider.tsx) manages visual appearance:
- Storage Key:
localStorage.getItem("tks_theme")("light"or"dark", defaulting to"light"). - DOM Application: Toggles the
darkCSS class ondocument.documentElement(html), enabling Tailwind CSS dark palettes (dark:bg-slate-900, etc.) without reloading the page. - Access: Available anytime from the Sun/Moon icon in the
Headeror from the/accountpage.
FR / EN Internationalization (I18nProvider)
The I18nProvider engine (src/lib/i18n/I18nProvider.tsx) delivers a fully bilingual console:
- Storage Key:
localStorage.getItem("tks_locale")("fr"by default, or"en"). - Mechanism: Exposes the
useI18n()hook providing{ locale, setLocale, t }for structured keys (nav.*,header.*,common.*) alongside a DOM observer (MutationObserver+TreeWalker) that dynamically translates UI strings when the"en"locale is active.