Shared Component Library
The @matih/shared library is the foundation of the MATIH frontend, providing 102 reusable components, 28+ custom hooks, 16 API client modules, and shared state management across all nine workbenches. Located at frontend/shared/src/, this library ensures consistent behavior, design language, and API integration patterns across the entire platform.
Library Organization
shared/src/
api/ # 16 API client modules
client.ts # Base ApiClient class
bi.ts # BIApiClient
query.ts # QueryApiClient
semantic.ts # SemanticApiClient
ai.ts # AIApiClient
ml.ts # MLApiClient
data.ts # DataApiClient
pipeline.ts # PipelineApiClient
dbt.ts # DbtApiClient
dataQuality.ts # DataQualityApiClient
governance.ts # GovernanceApiClient
ontology.ts # OntologyApiClient
render.ts # RenderApiClient
opsAgent.ts # OpsAgentApiClient
agentStudio.ts # AgentStudioApiClient
notification.ts # NotificationApiClient
billing.ts # BillingApiClient
components/ # 102 reusable components in 33 directories
Auth/ # Authentication (AuthGuard, LoginForm, ProtectedRoute, etc.)
Navigation/ # Navigation (Sidebar, TopNavigation, GlobalSearch, etc.)
ErrorBoundary/ # Error handling (ErrorBoundary, WidgetErrorBoundary)
Loading/ # Loading states (Skeleton, LoadingSpinner, LoadingOverlay)
MonacoEditor/ # Code editors (SqlEditor)
Collaboration/ # Multi-user (PresenceIndicator, CommentsPanel, ShareDialog)
Toast/ # Notifications (Toast, ToastProvider)
Lineage/ # Data lineage (LineageGraph, LineageNode, LineageEdge)
Portal/ # Dashboard portal (WelcomeHeader, QuickActions, etc.)
StatusPanel/ # Status displays (StatusBar, SLAPanel, etc.)
... (20+ more)
hooks/ # 28+ custom React hooks
stores/ # Zustand stores
state/ # Custom store framework
realtime/ # WebSocket, SSE, presence
observability/ # Frontend telemetry
services/ # Offline, semantic cache
styles/ # Design tokens
types/ # Canonical types
utils/ # Shared utilitiesComponent Categories
Authentication (8 components)
| Component | File | Purpose |
|---|---|---|
AuthGuard | Auth/AuthGuard.tsx | Session verification and route protection |
AuthProvider | Auth/AuthProvider.tsx | Authentication context provider |
LoginForm | Auth/LoginForm.tsx | Login form with validation |
RegisterForm | Auth/RegisterForm.tsx | User registration form |
ProtectedRoute | Auth/ProtectedRoute.tsx | Route-level auth gating |
PermissionGuard | Auth/PermissionGuard.tsx | Permission-based content gating |
SessionManager | Auth/SessionManager.tsx | Session lifecycle management |
ProfileManager | Auth/ProfileManager.tsx | User profile editing |
Navigation (12 components)
| Component | File | Purpose |
|---|---|---|
Sidebar | Navigation/Sidebar.tsx | Collapsible side navigation |
TopNavigation | Navigation/TopNavigation.tsx | Top header bar with search and user menu |
GlobalSearch | Navigation/GlobalSearch.tsx | Platform-wide search |
UserMenu | Navigation/UserMenu.tsx | User profile dropdown |
TenantSelector | Navigation/TenantSelector.tsx | Multi-tenant switcher |
PersonaSwitcher | Navigation/PersonaSwitcher.tsx | Role-based UI switching |
EnvironmentSwitcher | Navigation/EnvironmentSwitcher.tsx | Dev/staging/prod switching |
NotificationCenter | Navigation/NotificationCenter.tsx | Notification drawer |
CIStatusBadge | Navigation/CIStatusBadge.tsx | CI/CD status indicator |
Error Handling (4 components)
| Component | File | Purpose |
|---|---|---|
ErrorBoundary | ErrorBoundary/ErrorBoundary.tsx | React error boundary with Sentry integration |
WidgetErrorBoundary | ErrorBoundary/WidgetErrorBoundary.tsx | Widget-level error isolation |
WorkbenchErrorBoundary | ErrorBoundary/WorkbenchErrorBoundary.tsx | Workbench-level error handling |
withErrorBoundary | ErrorBoundary/withErrorBoundary.tsx | HOC for error boundary wrapping |
Observability (1 component, 5 hooks)
| Component/Hook | File | Purpose |
|---|---|---|
ObservabilityProvider | observability/ObservabilityProvider.tsx | Root-level provider that initializes Sentry, Web Vitals, session tracking, and global error handlers |
useTrackEvent | observability/hooks.ts | Track custom analytics events |
useTrackPage | observability/hooks.ts | Track page views with automatic route detection |
useErrorCapture | observability/hooks.ts | Capture and report errors with component context |
useObservability | observability/hooks.ts | Access the full ObservabilityManager instance |
ObservabilityProvider Usage
All 8 workbenches wrap their root component with ObservabilityProvider as the outermost provider:
import { ObservabilityProvider } from '@matih/shared';
export function App() {
return (
<ObservabilityProvider appName="bi-workbench">
<ErrorBoundary name="BiWorkbench">
{/* App content */}
</ErrorBoundary>
</ObservabilityProvider>
);
}Props:
| Prop | Type | Default | Description |
|---|---|---|---|
appName | string (required) | - | Identifies the workbench in telemetry |
appVersion | string | '1.0.0' | App version for release tracking |
sentryDsn | string | - | Sentry DSN for error tracking |
environment | string | 'development' | Environment name |
enableWebVitals | boolean | true | Track Core Web Vitals (CLS, LCP, INP, FCP, TTFB) |
enableSessionTracking | boolean | true | Track user session lifecycle |
enableGlobalErrorHandlers | boolean | true | Catch uncaught errors and unhandled promise rejections |
Workbench Integration Status:
| Workbench | appName | Status |
|---|---|---|
| ops-workbench | ops-workbench | Integrated |
| bi-workbench | bi-workbench | Integrated |
| data-workbench | data-workbench | Integrated |
| ml-workbench | ml-workbench | Integrated |
| agentic-workbench | agentic-workbench | Integrated |
| control-plane-ui | control-plane-ui | Integrated |
| data-plane-ui | data-plane-ui | Integrated |
| onboarding-ui | onboarding-ui | Integrated |
Visualization and Data (15+ components)
| Component | File | Purpose |
|---|---|---|
LineageGraph | Lineage/LineageGraph.tsx | Interactive lineage visualization |
LineageNode | Lineage/LineageNode.tsx | Custom lineage graph node |
LineageEdge | Lineage/LineageEdge.tsx | Custom lineage graph edge |
PlatformAnalytics | Analytics/PlatformAnalytics.tsx | Cross-tenant analytics dashboard |
SystemHealthPanel | Telemetry/SystemHealthPanel.tsx | System health overview |
UsageMetrics | Telemetry/UsageMetrics.tsx | Platform usage metrics |
BillingDashboard | Billing/BillingDashboard.tsx | Billing overview |
AuditLogViewer | Audit/AuditLogViewer.tsx | Audit event viewer |
For detailed breakdowns of each component category, see the Shared Library Deep Dive section.