Skip to content
/ netviz Public

๐ŸŒ NetViz โ€” Real-time network request visualizer with animated topology, timing waterfalls, and live traffic simulation. Built with React 18, TypeScript, Vite, and Canvas animations for a GitHub Copilot training workshop.

Notifications You must be signed in to change notification settings

hoodini/netviz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

11 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

React 18 TypeScript Vite Tailwind CSS

๐ŸŒ NetViz

A real-time network request visualizer with animated topology, timing waterfalls, and live traffic simulation.

Built as a demo project for a GitHub Copilot training workshop โ€” showcasing modern React patterns, canvas animations, and dark-themed data visualization.


โœจ Features

Feature Description
๐Ÿ—บ๏ธ Animated Topology Live canvas rendering of network topology โ€” Client, CDN, API Gateway, Server, and Database nodes with glowing packet animations traversing the graph in real time
๐Ÿ“‹ Request Log Scrollable feed of captured HTTP requests with method badges, status codes, response times, and payload sizes
๐Ÿ” Request Inspector Deep-dive panel showing full request/response headers, payload preview, and per-phase timing breakdown
๐Ÿ“Š Timing Waterfall Visual breakdown of each request phase โ€” DNS lookup, TCP connect, TLS handshake, request send, and response download
๐Ÿ“ˆ Live Stats Dashboard Real-time KPIs: total requests, success/error counts, average response time, data transferred, and requests/sec
๐ŸŽฎ Capture Controls Start/pause traffic capture, clear logs, and color-coded method legend (GET, POST, PUT, PATCH, DELETE)

๐ŸŽจ Design

  • Dark theme by default โ€” deep navy surfaces (#0a0e17) with vibrant accent colors
  • Glass-morphism panels with subtle borders and backdrop effects
  • Canvas-rendered topology with radial glow effects, dashed edges, and animated packet trails
  • Color-coded HTTP methods โ€” Blue (GET), Green (POST), Yellow (PUT), Red (DELETE/Error), Purple (PATCH)
  • Responsive grid layout โ€” adapts from mobile to widescreen

๐Ÿ—๏ธ Architecture

System Overview

flowchart TB
    subgraph UI["๐ŸŽจ User Interface"]
        App[App Component]
        Controls[ControlBar<br/>Start/Pause/Clear]
        Stats[StatsBar<br/>Live KPIs]
        Topology[TopologyCanvas<br/>Animated Network Graph]
        RequestLog[RequestList<br/>HTTP Request Feed]
        Inspector[RequestInspector<br/>Request Details]
        Waterfall[TimingWaterfall<br/>Phase Breakdown]
    end
    
    subgraph State["โšก State Management"]
        Hook[useNetworkCapture Hook]
        ReqState[(Requests State)]
        PktState[(Packets State)]
        StatState[(Stats State)]
    end
    
    subgraph Services["๐Ÿ”ง Services & Utils"]
        Mock[mockTraffic.ts<br/>Traffic Generator]
        Colors[colors.ts<br/>Theme & Utils]
        Types[network.ts<br/>Type Definitions]
    end
    
    App --> Controls
    App --> Stats
    App --> Topology
    App --> RequestLog
    App --> Inspector
    App --> Waterfall
    
    Controls -->|User Actions| Hook
    RequestLog -->|Selection| Inspector
    Inspector --> Waterfall
    
    Hook --> ReqState
    Hook --> PktState
    Hook --> StatState
    
    Hook -->|Generate Traffic| Mock
    Hook -->|Format Data| Colors
    
    ReqState -.->|Subscribe| Stats
    ReqState -.->|Subscribe| RequestLog
    PktState -.->|Subscribe| Topology
    StatState -.->|Subscribe| Stats
    
    Types -.->|Type Safety| Hook
    Types -.->|Type Safety| Mock
    
    classDef uiClass fill:#3b82f6,stroke:#2563eb,color:#fff
    classDef stateClass fill:#10b981,stroke:#059669,color:#fff
    classDef serviceClass fill:#8b5cf6,stroke:#7c3aed,color:#fff
    
    class Controls,Stats,Topology,RequestLog,Inspector,Waterfall,App uiClass
    class Hook,ReqState,PktState,StatState stateClass
    class Mock,Colors,Types serviceClass
Loading

Component Hierarchy

flowchart LR
    Root[๐ŸŒ App.tsx]
    Root --> Bar1[ControlBar]
    Root --> Bar2[StatsBar]
    Root --> Canvas[TopologyCanvas]
    Root --> List[RequestList]
    Root --> Inspect[RequestInspector]
    
    Inspect --> Water[TimingWaterfall]
    
    Root -.->|useNetworkCapture| Hook[useNetworkCapture Hook]
    Hook -.->|mockTraffic| Mock[Traffic Generator]
    
    classDef component fill:#0ea5e9,stroke:#0284c7,color:#fff
    classDef hook fill:#f59e0b,stroke:#d97706,color:#fff
    classDef service fill:#ec4899,stroke:#db2777,color:#fff
    
    class Root,Bar1,Bar2,Canvas,List,Inspect,Water component
    class Hook hook
    class Mock service
Loading

Data Flow

sequenceDiagram
    participant User
    participant UI as UI Components
    participant Hook as useNetworkCapture
    participant Mock as mockTraffic
    participant State as React State
    
    User->>UI: Click "Start Capture"
    UI->>Hook: handleStartCapture()
    activate Hook
    Hook->>Mock: generateRequest()
    Mock-->>Hook: NetworkRequest object
    Hook->>State: Update requests[]
    Hook->>State: Update packets[]
    Hook->>State: Update stats
    deactivate Hook
    
    State-->>UI: Re-render
    UI-->>User: Display updated visuals
    
    loop Every 1-3 seconds
        Hook->>Mock: generateRequest()
        Mock-->>Hook: New request
        Hook->>State: Append to state
        State-->>UI: Trigger re-render
    end
    
    User->>UI: Select request
    UI->>Hook: setSelectedRequest(id)
    Hook->>State: Update selection
    State-->>UI: Show Inspector panel
Loading

File Structure

src/
โ”œโ”€โ”€ components/
โ”‚   โ”œโ”€โ”€ TopologyCanvas.tsx    # Canvas-based network topology with packet animation
โ”‚   โ”œโ”€โ”€ RequestList.tsx       # Scrollable request log with selection
โ”‚   โ”œโ”€โ”€ RequestInspector.tsx  # Detailed request/response viewer
โ”‚   โ”œโ”€โ”€ TimingWaterfall.tsx   # Per-phase timing visualization
โ”‚   โ”œโ”€โ”€ StatsBar.tsx          # Live KPI stat cards
โ”‚   โ””โ”€โ”€ ControlBar.tsx        # Capture toggle, clear, and legend
โ”œโ”€โ”€ hooks/
โ”‚   โ””โ”€โ”€ useNetworkCapture.ts  # Core state management โ€” requests, packets, stats
โ”œโ”€โ”€ services/
โ”‚   โ””โ”€โ”€ mockTraffic.ts        # Realistic mock HTTP traffic generator
โ”œโ”€โ”€ types/
โ”‚   โ””โ”€โ”€ network.ts            # TypeScript interfaces for the domain model
โ””โ”€โ”€ utils/
    โ””โ”€โ”€ colors.ts             # Color mappings, formatters, and ID generation

Key Patterns

  • Zero external state libraries โ€” pure React hooks (useState, useCallback, useRef, useEffect)
  • requestAnimationFrame loop for silky-smooth 60fps packet animations
  • Mock traffic engine generating realistic HTTP requests with randomized timing phases, status codes, headers, and payloads
  • Canvas 2D API with HiDPI scaling, radial gradients, glow effects, and motion trails
  • Strict TypeScript โ€” no any, fully typed domain model

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn

Install & Run

# Clone the repository
git clone https://github.com/hoodini/netviz.git
cd netviz

# Install dependencies
npm install

# Start development server
npm run dev

Open http://localhost:5173 โ€” traffic simulation starts automatically.

Build for Production

npm run build
npm run preview

๐Ÿ› ๏ธ Tech Stack

Layer Technology
UI Framework React 18 with functional components
Language TypeScript (strict mode)
Build Tool Vite 6
Styling Tailwind CSS 3.4 (dark mode, custom design tokens)
Animations Canvas 2D API + requestAnimationFrame
State React hooks only

๐ŸŽฏ Workshop Context

This project was built as part of a GitHub Copilot training workshop to demonstrate:

  • AI-assisted development workflows with Copilot
  • Real-time data visualization in React
  • Canvas animations and custom rendering
  • TypeScript-first development with strict typing
  • Modern frontend architecture patterns

๐Ÿ“„ License

MIT


Built with โ˜• and GitHub Copilot by Yuval Avidani โ€” YUV.AI

About

๐ŸŒ NetViz โ€” Real-time network request visualizer with animated topology, timing waterfalls, and live traffic simulation. Built with React 18, TypeScript, Vite, and Canvas animations for a GitHub Copilot training workshop.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors