KubeView is an advanced Kubernetes attack path visualizer. The frontend repository is a robust, high-performance web application constructed with Next.js 14, React 18, and TypeScript.
It features two main visual halves:
- The application interface (Dashboard, login, signup) using standard App Router pages and libraries like React Flow.
- The cinematic landing page (
app/page.tsx), built to act as a visually addictive, scroll-linked product showcase featuring bespoke 60fps HTML5 Canvas animations.
- Framework: Next.js 14 (App Router)
- Core language: TypeScript
- UI & State: React 18
- Node/Graph Dashboards: React Flow (used in the core
dashboardroutes) - Animations:
- Custom
requestAnimationFramehooks for<canvas>features. - Native CSS Animations & Keyframes (
@keyframes,transition). - Framer Motion (if used in modular components).
- Custom
- Styling Strategy:
- Custom inline CSS Variables scoped to
:rootto enforce the Design System tokens. - Granular
style={{}}injections for high-performance animation updates (bypassing the React virtual DOM layer when tied to scroll events).
- Custom inline CSS Variables scoped to
The application leverages the Next.js app directory structure to maintain secure, nested routing.
| Route | Path | Description |
|---|---|---|
| Landing Page | app/page.tsx |
The root index. A 1000+ line cinematic marquee file showcasing the core product visualizations via scroll-linked storytelling. |
| Authentication | app/(auth)/* |
Standard user authentication pages including /login and /signup. |
| Dashboard | app/dashboard/* |
The interactive, authenticated application interface where users connect clusters and view actual attack graphs. |
| API Layer | lib/api.ts |
Data-fetching utilities and backend communication wrappers. |
The visual language follows a strict "Dark Cybersecurity / Matrix Ops" theme. We absolutely avoid lime greens or neon magentas in favor of precise, stark accents: Deep Navy black, Cold Data Blue, Warn/Hero Orange, and Crown Jewel Amber.
- Base Background (
--bg):#0A0E1A— A midnight navy/black that anchors the UI. - Hero / CTA Action (
--primary):#F97316(Warm Orange) — Used for primary buttons, the pulsing attack path tracer, cursor, and key hover states. - Data Structure (
--secondary):#38BDF8(Sky Blue) — Represents benign data flow: baseline pod nodes, matrix rain, standard terminal outputs. - Crown Jewels (
--amber):#F59E0B— Used for database nodes, value targets, and golden badges. - Threat / Attack (
--red):#EF4444— Secrets, detected threat paths, flashing alert borders. - Safe / Verifications (
--green):#22C55E— Role nodes and trust indicators. - RBAC / Configuration (
--purple):#A78BFA— ServiceAccounts, ConfigMaps, and RoleBindings. - Typography: Inter (sans-serif) for body text; JetBrains Mono for system UI and terminal text.
The root page.tsx is broken down into 8 high-performance sections, driven by framer-motion and native Canvas logic.
A full-bleed viewport canvas mapping out a mock cluster. Features floating nodes, pulsing dashed edges, and a moving Orange "Attack Tracer" traversing the graph. A minimal matrix rain effect falls in the background.
A sticky (position: sticky, height: 100vh) section acting as a scroll-jacking 2-column layout. The left column lists scroll phases, while the right column's canvas dynamically builds an attack graph node-by-node based on the window.scrollY depth.
A multi-panel horizontal visualizer that renders 4 separate canvas widgets simultaneously:
- BFS Traversal: Demonstrates spanning tree algorithms finding the shortest path to a crown jewel.
- RBAC Over-privilege: Orbital physics showing identities orbiting highly-privileged roles.
- CVE Feeds: Scrolling severity alerts mapping to targeted containers.
- Crown Jewels: Golden hexagonal databases pulsing to depict isolation rings.
A mock command-line interface highlighting the speed of pathfinding with "typing" text arrays simulating real-time graph database queries (e.g., MATCH (n:Pod) RETURN n).
Counter-based ticker animations highlighting indexed nodes and zero-trust verification badges.
To render 6+ concurrent canvases at 60fps within a React tree without devastating device CPU, several techniques are employed:
ResizeObserverCanvas Scaling: Canvas components don't rely purely on CSS or window resize events. Every canvas initializes vianew ResizeObserver()tied securely to its parent.offsetWidth/.offsetHeight. A per-frame bail-out (if (!W || !H) return;) prevents hydration mismatches and guarantees zero "blank black box" renders.- Fractional Coordinates (
0.0-1.0): Canvas node matrices are defined in percentages, dynamically converted to pixels(d.rx * W)inside therequestAnimationFrameloop. This permits flawless continuous responsive resizing without expensive recalculations. IntersectionObserverCulling: HeavyrequestAnimationFramedraws are paused when standard sections scroll out of the browser viewport.- CSS Overlays: Intensive background effects like pixel noise or scan lines are rendered using pure CSS properties (
repeating-linear-gradient, data-uri SVG turbulence) paired withmix-blend-moderather than drawing thousands of pixels manually on canvas frames. - No Hydration Errors: The heavy inline CSS injection string (
<style suppressHydrationWarning>{CSS}</style>) prevents Next.js from panicking when server HTML vs client styles differ dynamically at runtime.
Install dependencies for the frontend application: ```bash
npm install ```
Run the Next.js development server: ```bash npm run dev ```
The console will indicate that the application has booted on http://localhost:3000.
If you encounter port conflicts (e.g., localhost not starting), guarantee any hanging node instances are terminated (e.g., taskkill /F /IM node.exe on Windows or killall node on macOS) before launching.
(Note: Any integrations handling login requests or querying live clusters via lib/api.ts require the complimentary Go/Node backend to be configured and running locally on its designated port).