Skip to main content

Frontend Overview

Architecture

Frontend CLM dibangun dengan React 19 + TypeScript + Vite dan menggunakan shadcn/ui sebagai UI component library.

Directory Structure

frontend/
├── src/
│ ├── api/ # API client modules
│ │ ├── auth.ts # Authentication API
│ │ ├── logs.ts # Log search API
│ │ ├── http.ts # Core fetch wrapper
│ │ ├── service.ts # Service management API
│ │ └── rbac.ts # RBAC management API
│ ├── components/
│ │ ├── ui/ # shadcn/ui primitives (46 components)
│ │ ├── sidebar.tsx # Navigation sidebar
│ │ ├── header.tsx # Top header
│ │ └── charts/ # Chart components
│ ├── data/
│ │ ├── roles.ts # Role definitions
│ │ ├── compliance.ts # Compliance data
│ │ └── sizing.ts # Layout sizing
│ ├── hooks/ # Custom React hooks
│ ├── lib/
│ │ ├── app-context.tsx # Auth & tenant state
│ │ ├── utils.ts # Utility functions
│ │ └── types.ts # TypeScript types
│ ├── routes/ # Page components
│ │ ├── login.tsx # Login page
│ │ ├── index.tsx # Dashboard
│ │ ├── search.tsx # Log search
│ │ ├── sources.tsx # Log sources
│ │ ├── alerting.tsx # Alert management
│ │ ├── security.tsx # Security monitoring
│ │ ├── compliance.tsx # Compliance dashboard
│ │ ├── apm.tsx # Application monitoring
│ │ ├── reporting.tsx # Reports
│ │ ├── master-data.tsx # Master data management
│ │ ├── architecture.tsx # System architecture
│ │ └── infrastructure.tsx # Infrastructure monitoring
│ ├── router.tsx # React Router config
│ ├── app.tsx # Root app component
│ ├── main.tsx # React root mount
│ ├── i18n.ts # Internationalization
│ └── styles.css # Tailwind CSS styles
├── package.json
├── vite.config.ts
├── tsconfig.json
└── Dockerfile.prod

Key Files

FileDescription
router.tsxRoute definitions dengan AuthGuard
app-context.tsxAuth state, tenant management
http.tsCore fetch wrapper dengan JWT injection
app.tsxRoot component (QueryClient, Auth, Router)
main.tsxReact mount point

Pages

Login Page (/login)

  • Authentication form
  • Keycloak integration
  • JWT token storage

Dashboard (/)

  • Pipeline status overview
  • Data center monitoring
  • Throughput metrics
  • Log volume charts
  • Full-text log search
  • Time range filtering
  • Field-based filtering
  • Paginated results
  • Log histogram visualization

Log Sources (/sources)

  • Docker container logs
  • System logs
  • Application logs
  • Source configuration

Alerting (/alerting)

  • Alert rules management
  • Active alerts list
  • Alert history
  • Telegram notification setup

Security (/security)

  • Wazuh alerts
  • Security monitoring
  • Threat detection
  • Alert correlation

Compliance (/compliance)

  • ISO 27001 compliance
  • ISO 20022 compliance
  • ISO 22301 compliance
  • Audit trail

APM (/apm)

  • Service map visualization
  • Distributed tracing
  • Service trace analysis

Reporting (/reporting)

  • Report generation
  • Data export
  • Scheduled reports

Master Data (/master-data)

  • Tenant management
  • User management
  • Role management
  • Application management
  • Permission management

Architecture (/architecture)

  • System architecture view
  • Component diagram
  • Data flow diagram

Infrastructure (/infrastructure)

  • Container metrics (cAdvisor)
  • Host metrics (Node Exporter)
  • Network monitoring
  • Collector health

Component Library

shadcn/ui Components (46)

Frontend menggunakan shadcn/ui dengan style New York dan base color Slate:

CategoryComponents
LayoutAccordion, Aspect Ratio, Resizable Panel, Separator, Scroll Area
FormsButton, Checkbox, Input, Label, Radio Group, Select, Slider, Switch, Textarea, Toggle, Toggle Group
Data DisplayAvatar, Badge, Card, Table, Calendar
FeedbackAlert, Alert Dialog, Dialog, Drawer, Popover, Tooltip, Sonner (Toast)
NavigationBreadcrumb, Command, Context Menu, Dropdown Menu, Menubar, Navigation Menu, Pagination, Tabs
OverlayCollapsible, Hover Card

Custom Components

ComponentDescription
SidebarNavigation sidebar dengan role-based menu
HeaderTop header dengan user info dan tenant selector
ChartsRecharts-based chart components
LogTableLog search results table
AlertCardAlert display card
ServiceMapService dependency visualization

State Management

AppContext

type AppState = {
tenantId: string;
setTenantId: (t: string) => void;
roleId: RoleId;
setRoleId: (r: RoleId) => void;
isAuthed: boolean;
setAuthed: (v: boolean) => void;
userName: string;
setUserName: (n: string) => void;
userRoles: string[];
setUserRoles: (r: string[]) => void;
tenantIdClaim: string;
setTenantIdClaim: (t: string) => void;
tenantName: string;
setTenantName: (n: string) => void;
};

localStorage Persistence

State disimpan di localStorage dengan key tssmartlog-state-v1:

// Restore on mount
useEffect(() => {
const raw = localStorage.getItem(KEY);
if (raw) {
const s = JSON.parse(raw);
if (s.tenantId) setTenantId(s.tenantId);
if (s.roleId) setRoleId(s.roleId);
if (typeof s.isAuthed === 'boolean') setAuthed(s.isAuthed);
}
}, []);

// Persist on change
useEffect(() => {
localStorage.setItem(KEY, JSON.stringify({
tenantId, roleId, isAuthed, userName, userRoles
}));
}, [tenantId, roleId, isAuthed, userName, userRoles]);

Next Steps