npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

black-proxy

v1.1.1

Published

A TypeScript-based HTTP/WebSocket proxy server with routing table configuration.

Readme

Black Proxy

A TypeScript-based HTTP/WebSocket proxy server with routing table configuration.

Features

  • HTTP and WebSocket proxying
  • Domain-based routing configuration
  • PM2 process management
  • Comprehensive logging
  • TypeScript support with strict type checking

Project Structure

black-proxy/
├── src/                    # TypeScript source files
│   ├── types.ts           # Type definitions
│   ├── _routingTable.ts   # Routing configuration
│   ├── proxy.ts           # Main proxy server
│   ├── run.ts             # Server startup script
│   ├── stop.ts            # Server shutdown script
│   └── test.ts            # WebSocket test client
├── build/                  # Compiled JavaScript runfiles
├── tsconfig.json          # TypeScript configuration
├── package.json           # Project dependencies and scripts
└── README.md              # This file

Installation

Install dependencies:

npm install

Configuration

Edit src/_routingTable.ts to configure your routing table:

import { RoutingTable } from './types';

const routingTable: RoutingTable = {
    'your-domain.com': {
        port: 3000,
        host: '[::1]',
    },
    'ws-domain.com': {
        host: '[::1]',
        port: 3001,
        ws: true  // Enable WebSocket support
    }
};

export default routingTable;

Usage

Production

Build and start the proxy server:

npm start

Stop the proxy server:

npm stop

Scripts

  • npm start - Start the proxy server with PM2
  • npm stop - Stop the proxy server
  • npm test - Test ws server on the other side of proxy (port 3006)

Type Definitions

The project includes comprehensive TypeScript types:

RouteConfig

interface RouteConfig {
  port: number;
  host?: string;
  ws?: boolean;
}

RoutingTable

interface RoutingTable {
  [domain: string]: RouteConfig;
}

Features

HTTP Proxying

  • Automatic domain-based routing
  • Support for custom headers
  • Client IP logging
  • Error handling and logging

WebSocket Support

  • WebSocket upgrade handling
  • Socket.IO compatibility
  • Protocol detection (ws/wss)
  • Connection logging

Process Management

  • PM2 integration for process management
  • Automatic restart on failure
  • Log streaming
  • Graceful shutdown

Logging

  • Comprehensive request/response logging
  • Error tracking
  • Client IP tracking
  • Timestamp logging

Requirements

  • Node.js 16+
  • npm or yarn
  • PM2 (installed as dependency)
  • @rws-framework/tsc (transpiler, installed as dependency)

License

ISC