frontend

package
v0.8.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

README

KCP Frontend

React + TypeScript frontend for the KCP web UI.

Development

Prerequisites
  • Node.js 18+
  • Yarn
Setup
yarn install
Development Server
yarn dev

Frontend runs on http://localhost:5173 with hot reload.

Build
yarn build

Built assets are embedded into the Go binary via frontend.go.

Type Checking
yarn type-check
yarn type-check:watch
Linting
yarn lint

Testing

E2E Tests with Playwright

Playwright tests run against the full Go backend + frontend.

Run all tests:

yarn test:e2e

Run with UI mode (interactive):

yarn test:e2e:ui

Debug specific test:

yarn test:e2e:debug osk-sidebar.spec.ts

Run with browser visible:

yarn test:e2e:headed
Test Fixtures

Test fixtures are in tests/fixtures/:

  • state-osk-only.json - Apache Kafka clusters only
  • state-both.json - Both MSK and Apache Kafka clusters

Architecture

Source Types

The UI supports two Kafka source types:

MSK (AWS Managed Streaming for Kafka)

  • Regions → Clusters hierarchy
  • Displays: ARN, VPC, instance type, CloudWatch metrics, costs
  • Tabs: Cluster, Metrics, Topics, ACLs, Connectors, Clients

Apache Kafka

  • Flat cluster list
  • Displays: Bootstrap servers, metadata, labels
  • Tabs: Cluster, Topics, ACLs, Connectors, Clients (no Metrics)
State Management
  • Zustand for global state
  • useAppStore hook provides access to:
    • processedState - unified source data
    • selectedSourceType - 'msk' | 'osk'
    • selectOSKCluster(clusterId) - navigate to Apache Kafka cluster
    • selectCluster(region, arn) - navigate to MSK cluster
Type Guards

Use type guards from lib/sourceUtils.ts to safely access source-specific data:

import { isMSKSource, isOSKSource } from '@/lib/sourceUtils'

const mskSource = processedState?.sources.find(isMSKSource)
const oskSource = processedState?.sources.find(isOSKSource)

Tech Stack

  • React 19
  • TypeScript 5.8
  • Vite 7
  • Zustand (state management)
  • Recharts (charts)
  • Tailwind CSS 4
  • Playwright (E2E testing)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(e *echo.Echo)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL