Skip to content

rohit-jsfreaky/node-network-tab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

node-network-tab

๐Ÿ” Chrome DevTools-style network inspector for Node.js - Intercept and visualize all HTTP/HTTPS requests in an interactive terminal dashboard.

npm version Node.js License: MIT GitHub

Demo

โœจ Features

  • ๐ŸŽฏ Zero-Config Magic - Just import the package, everything works automatically
  • ๐Ÿ”’ Non-Destructive - Intercepts requests without modifying behavior
  • ๐ŸŽจ Beautiful TUI - Professional terminal UI with color-coded status
  • โšก Real-time Updates - See requests as they happen
  • ๐Ÿ”Ž Smart Filtering - Filter by URL, method (GET/POST), status (200/500), or fuzzy search
  • โฑ๏ธ Timing Breakdown - See where time went: DNS, TCP, TTFB, Download with waterfall chart
  • ๐Ÿ“ฆ Size & Compression - See transferred vs resource size with compression savings
  • ๐Ÿ”„ Request Replay - Re-run any request without restarting the app
  • ๐Ÿ“‹ Request/Response Details - View headers, body, and response data
  • ๐ŸŽจ Syntax Highlighting - Colorized JSON with keys, strings, numbers, booleans
  • โŒจ๏ธ Keyboard Navigation - Vim-style (j/k) and arrow key support
  • ๐Ÿ” Expand Mode - View full response body with scrolling
  • ๐Ÿ“‹ Copy to Clipboard - Copy headers/body/response or as cURL command
  • ๐Ÿ›ก๏ธ Safety First - Only runs in development mode

๐Ÿ“ฆ Installation

npm install node-network-tab

๐Ÿš€ Quick Start

Separate Terminal Mode (Recommended)

This keeps your app logs clean and opens the UI in a second terminal:

import 'node-network-tab/start';

// Your application code...
// All HTTP/HTTPS requests are now monitored!
# Terminal 1: run your app as usual
node server.js

# (optional) explicit headless flag
NODE_NETWORK_TAB_HEADLESS=1 node server.js

# Terminal 2: open the viewer
npx node-network-tab

Inline UI Mode (optional)

If you prefer the UI to open in the same terminal as your app:

NODE_NETWORK_TAB_INLINE_UI=1 node server.js

Programmatic Mode

For more control:

import { startInterceptor, renderUI, stopInterceptor } from 'node-network-tab';

// Start intercepting
startInterceptor();

// Render the TUI (optional - only works in TTY terminals)
renderUI();

// Your application code...

// Stop intercepting when done
stopInterceptor();

Headless Logs (optional)

If you want minimal request logs in the app terminal (without UI):

NODE_NETWORK_TAB_HEADLESS_LOGS=1 node server.js

๐ŸŽฎ Keyboard Controls

Key Action
/ or f Open filter bar
โ†‘ / k Navigate up (requests or scroll in expand mode)
โ†“ / j Navigate down (requests or scroll in expand mode)
Tab / l / h Switch detail tabs
1 Headers tab
2 Body tab
3 Response tab
e Toggle expand mode (full-screen detail view)
r Replay selected request
x Copy request as cURL command
y Copy current tab content to clipboard
c Clear all requests and filter
q Quit

๐Ÿ”Ž Smart Filtering

Press / or f to open the filter bar. The filter supports:

Filter Type Example Description
Method GET, POST Show only requests with that method
Status Code 200, 404, 5 Match exact code or prefix (5 = 5xx)
Status Keywords error, success, pending Filter by status category
Fuzzy Search user, api Match any part of URL/path
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ๐Ÿ” Node Network Tab                     ๐Ÿ”Ž "GET" 3/9 | /:filter | q:quit      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Requests (filtered)              โ”‚โ”‚ GET https://api.example.com/users         โ”‚
โ”‚                                  โ”‚โ”‚                                           โ”‚
โ”‚ โ–ถ GET    /users        200 142ms โ”‚โ”‚  [ 1:Headers ] [ 2:Body ] [ 3:Response ]  โ”‚
โ”‚   GET    /users/1      200 89ms  โ”‚โ”‚                                           โ”‚
โ”‚   GET    /posts        200 156ms โ”‚โ”‚  Status: 200 (142ms)                      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ๐Ÿ”Ž Filter: GET                                | Enter:apply | Esc:clear       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Filter Bar Controls:

  • Type to filter requests
  • Press Enter to apply and close the filter bar
  • Press Esc to clear the filter and close

๐Ÿ” Expand Mode

Press e to toggle expand mode and view the full response/body/headers:

In Expand Mode:

  • Use โ†‘/โ†“ or j/k to scroll through content
  • Press y to copy the full content to clipboard
  • Press e again to collapse back to normal view

๐Ÿ“Š Normal UI Layout

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Request List     โ”‚          Request Details               โ”‚
โ”‚   (35% width)      โ”‚          (65% width)                   โ”‚
โ”‚                    โ”‚                                        โ”‚
โ”‚ โ–ถ GET /api/users   โ”‚  [ 1:Headers ] [ 2:Body ] [ 3:Response ]โ”‚
โ”‚   POST /api/login  โ”‚                                        โ”‚
โ”‚   GET /api/data    โ”‚  Status: 200 (142ms)                   โ”‚
โ”‚                    โ”‚  ๐Ÿ“ฅ Response Body โ—‹ e:expand | y:copy   โ”‚
โ”‚                    โ”‚  {                                     โ”‚
โ”‚                    โ”‚    "users": [...]                      โ”‚
โ”‚                    โ”‚  }                                     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ›ก๏ธ Safety Features

Feature Description
Production Safety Automatically disabled when NODE_ENV=production
Memory Safety Only keeps the last 50 requests
Non-Destructive Never modifies, blocks, or delays requests

๐Ÿ’ก Use Cases

  • Debug API Calls - See exactly what your app is sending to external services
  • Monitor Third-Party SDKs - Watch requests from Stripe, OpenAI, AWS, etc.
  • Development Mode Logging - Better visibility than console.log
  • Teaching/Learning - Understand how HTTP works in Node.js

๐Ÿ“ฆ Exports

// Main API
import {
  startInterceptor,
  stopInterceptor,
  isInterceptorActive,
  renderUI,
  unmountUI,
  store,
  getStore,
  interceptorEmitter,
} from 'node-network-tab';

// Types
import type {
  RequestLog,
  RequestStatus,
  RequestStartEvent,
  RequestBodyEvent,
  ResponseHeadersEvent,
  ResponseCompleteEvent,
  RequestErrorEvent,
} from 'node-network-tab';

๐Ÿ”ง How It Works

  1. Monkey Patching - Overrides http.request and https.request at the module level
  2. Transparent Interception - Captures data using event listeners and PassThrough streams
  3. EventEmitter Architecture - Internal events update the store and UI
  4. Ink TUI - React-based terminal UI with real-time updates

๐Ÿ“‹ Requirements

  • Node.js >= 18.0.0
  • Terminal with TTY support (for the UI)

๐Ÿ†š Comparison

Feature node-network-tab console.log Postman
Zero Config โœ… โœ… โŒ
Auto-capture โœ… โŒ โŒ
Real-time โœ… โœ… โŒ
Pretty UI โœ… โŒ โœ…
In-process โœ… โœ… โŒ
Smart Filtering โœ… โŒ โœ…
Expand/Scroll โœ… โŒ โœ…
Copy to Clipboard โœ… โŒ โœ…

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“„ License

MIT ยฉ rohit-jsfreaky


Made with โค๏ธ for the Node.js community

โญ Star on GitHub

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published