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

@jachy/multiport-proxy

v0.0.3

Published

A multi-port proxy server with web UI configuration

Readme

Multiport Proxy

一个功能强大的多端口代理服务,支持动态配置和实时日志查看。

multiport-proxy-screenshot

Features

  • 🚀 Web 配置界面 - 启动时自动打开 Web UI,轻松配置代理规则
  • 🔀 多端口代理 - 支持配置多个本地端口到目标服务的映射
  • ⚙️ 灵活配置 - 支持 CORS、超时、重试等可选配置
  • 📊 实时日志 - 在 Web 界面查看实时请求/响应日志,无需本地持久化
  • 💾 配置保存 - 配置自动保存,重启后自动加载
  • 🎯 零配置启动 - 开箱即用,无需复杂配置

快速开始

使用 npx(推荐)

无需安装,直接运行:

npx @jachy/multiport-proxy

全局安装

npm install -g @jachy/multiport-proxy
multiport-proxy

本地开发

# 克隆项目
git clone <your-repo-url>
cd multiport-proxy

# 安装依赖
pnpm install

# 开发模式
pnpm run dev

# 构建
pnpm run build

# 运行构建后的版本
pnpm start

项目架构

multiport-proxy/
├── src/
│   ├── server/
│   │   ├── proxy-server.ts          # 代理服务核心逻辑
│   │   ├── config-manager.ts        # 配置管理模块
│   │   └── logger.ts                # 日志管理模块
│   ├── web/
│   │   ├── api-routes.ts            # Web API 路由(配置/日志)
│   │   ├── ui/
│   │   │   ├── index.html           # Web 配置界面
│   │   │   ├── style.css            # 样式表
│   │   │   └── app.js               # 前端逻辑
│   │   └── middleware.ts            # Web 中间件
│   └── index.ts                     # 应用入口
├── data/
│   └── config.json                  # 配置持久化文件
├── package.json
└── tsconfig.json

核心流程

  1. 启动:应用启动时加载配置,初始化代理服务器和 Web 服务器
  2. Web UI:自动打开浏览器访问配置页面 (localhost:8888)
  3. 配置:用户通过 Web UI 添加/编辑/删除代理规则
  4. 代理:根据配置将请求转发到目标服务
  5. 日志:实时在 Web UI 显示请求日志,支持滚动查看

使用流程

启动项目

pnpm run dev

打开配置页面

自动打开 http://localhost:8888

配置代理规则

  1. 输入本地监听端口
  2. 输入目标服务地址(如 http://localhost:3000)
  3. 可选配置 CORS、超时等
  4. 点击"保存"

查看日志

  • 实时显示所有代理请求
  • 支持滚动查看历史日志
  • 按端口/状态码筛选

API 接口

获取配置

  • GET /api/config - 获取所有代理规则

保存配置

  • POST /api/config - 保存代理规则

获取日志

  • GET /api/logs - 获取实时日志(支持分页/筛选)

清空日志

  • DELETE /api/logs - 清空所有日志

配置文件格式

{
  "rules": [
    {
      "id": "rule-1",
      "localPort": 3000,
      "targetUrl": "http://api.example.com",
      "cors": {
        "enabled": true,
        "origins": ["*"]
      },
      "timeout": 30000,
      "retries": 0,
      "enabled": true
    }
  ]
}

开发要求

  • Node.js >= 16
  • TypeScript
  • Express.js (Web 服务器)
  • http-proxy (代理库)
  • React/Vue/Vanilla JS (前端)

许可证

ISC