'use client'; import { useState, useEffect } from 'react'; import { ArrowRight, Globe, Server, Cpu, Shield, RefreshCw } from 'lucide-react'; interface TunnelRoute { hostname: string; service: string; pi: string; group: string; } interface Node { name: string; ip: string; role: string; capacity: number; status: string; services: string[]; } const GROUP_COLORS: Record = { PRIMARY: '#FF1D6C', SECONDARY: '#2979FF', TERTIARY: '#F5A623', IDENTITY: '#9C27B0', }; const PI_ICONS: Record = { aria64: Cpu, 'blackroad-pi': Server, alice: Shield, cecilia: Globe, }; export default function NetworkPage() { const [tunnel, setTunnel] = useState<{ routes: TunnelRoute[]; by_pi: Record; tunnel_id: string } | null>(null); const [fleet, setFleet] = useState<{ nodes: Node[] } | null>(null); const [loading, setLoading] = useState(true); const load = async () => { try { const [t, f] = await Promise.all([fetch('/api/tunnel'), fetch('/api/fleet')]); if (t.ok) setTunnel(await t.json()); if (f.ok) setFleet(await f.json()); } catch {} setLoading(false); }; useEffect(() => { load(); }, []); const nodes = fleet?.nodes ?? []; const byPi = tunnel?.by_pi ?? {}; return (

Network

Cloudflare Edge → Tunnel → Pi Fleet → Services

{/* Tunnel header */}

Cloudflare Tunnel

{tunnel?.tunnel_id ?? '8ae67ab0-71fb-4461-befc-a91302369a7e'}

{tunnel?.routes.length ?? 14} routes · QUIC protocol · Dallas edge

Active
{/* Topology grid */}
{/* CF Edge */}

Cloudflare Edge

{['*.blackroad.io', '*.blackroad.ai', 'CNAME → tunnel'].map(d => (
{d}
))}
{/* Arrow */}
{/* Pi nodes */} {nodes.map((node) => { const Icon = PI_ICONS[node.name] ?? Server; const color = GROUP_COLORS[node.role] ?? '#888'; const routes = byPi[node.name] ?? []; return (
{/* Node header */}

{node.name}

{node.ip}

{node.role} {node.capacity > 0 && `· ${(node.capacity/1000).toFixed(1)}k slots`}
{/* Routes */}
{routes.map(r => ( ))} {routes.length === 0 && (

No tunnel routes

)}
); })}
{/* Stats footer */}
{[ { label: 'Total Routes', value: tunnel?.routes.length ?? 14, color: '#FF1D6C' }, { label: 'Pi Nodes', value: nodes.length || 4, color: '#2979FF' }, { label: 'Online', value: nodes.filter(n => n.status === 'online').length || '—', color: '#22c55e' }, { label: 'Agent Slots', value: '30,000', color: '#9C27B0' }, ].map(s => (
{s.label} {s.value}
))}
); }