network_activity_visualizer
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
index.ts
https://jeffreyyoung--38e7d1fa940511f0bc070224a6c84d84.web.val.run
A real-time request activity visualization system that tracks and displays all HTTP requests to your Val Town application with live updates via Server-Sent Events (SSE).
- Real-time monitoring: Live updates of all incoming requests via SSE
 - Request statistics: Total requests, success rate, error count, and average response time
 - Request details: Method, path, status code, duration, IP address, and user agent
 - Test endpoints: Built-in buttons to generate test traffic
 - Responsive design: Works on desktop and mobile devices
 - Always returns 200 OK: The monitoring endpoint itself never fails
 
├── backend/
│   └── index.ts             # Main Hono server with SSE and request logging
├── frontend/
│   └── index.html           # Dashboard UI with live updates
└── README.md               # This file
- 
Request Middleware: All requests are logged via Hono middleware that captures:
- Request method, path, and headers
 - Response status and duration
 - Client IP and user agent
 - Unique request ID and timestamp
 
 - 
Server-Sent Events: The
/api/eventsendpoint maintains persistent connections with browsers and broadcasts new request data in real-time - 
In-Memory Storage: Recent requests (last 100) are stored in memory for quick access and initial page load
 - 
Live Dashboard: The frontend connects via SSE and updates the UI immediately when new requests arrive
 
GET /- Main dashboard (always returns 200 OK)GET /api/events- SSE endpoint for live request updatesGET /api/requests- JSON API for recent requestsGET /api/test- Test endpoint for generating activityPOST /api/test- Test POST endpointGET /api/slow- Slow endpoint (2s delay) for testingGET /*- Any other path returns 404 (also logged)
- Visit the main dashboard at 
/ - The page will automatically connect to the SSE stream
 - Use the test buttons to generate sample requests
 - Watch requests appear in real-time with full details
 - Monitor statistics in the summary cards
 
- Built with Hono for the backend API framework
 - Uses native Server-Sent Events for real-time updates
 - TailwindCSS for responsive styling
 - No external dependencies for the frontend
 - Handles SSE connection failures with automatic reconnection
 - Animates new requests for better visual feedback
 
The dashboard shows connection status with colored indicators:
- 🟢 Green: Connected to SSE stream
 - 🟡 Yellow: Connecting/reconnecting
 - 🔴 Red: Disconnected
 
The system automatically attempts to reconnect if the SSE connection is lost.