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

@huynhthuc/portland

v1.0.6

Published

Portland CLI giúp quản lý nhanh mapping local và expose dịch vụ ra internet qua control-plane + FRP/tunnels.

Readme

Portland CLI

Portland CLI giúp quản lý nhanh mapping local và expose dịch vụ ra internet qua control-plane + FRP/tunnels.

Hiện tại trong bản build hiện hành, CLI expose các lệnh:

  • forward
  • forward-list
  • mesh
  • kill
  • export
  • import
  • start

1) Cài đặt CLI

npm install -g @huynhthuc/portland

Sau khi cài, kiểm tra:

portland --help

Hoặc khi chưa cài global:

npx @huynhthuc/portland --help

2) Cấu hình mặc định

  • Config mặc định: ~/portland/config.json
  • Hỗ trợ fallback đọc ~/.portland-proxy.json hoặc ~/.portland.json khi chưa có config mới.

Ví dụ cấu trúc config:

{
  "version": 1,
  "mappings": [
    {
      "name": "frontend",
      "listen": "127.0.0.1:3000",
      "target": "127.0.0.1:3000",
      "idleTimeout": 0,
      "killConflict": false,
      "killSignal": "SIGTERM",
      "active": true
    }
  ]
}

3) Các lệnh thường dùng

4.1 forward

Expose local service bằng sub-domain.

portland forward \
  -p 3000 \
  -s api-test \
  --base-url http://127.0.0.1:8787 \
  --protocol tcp \
  --admin-token <admin_token>

Kết quả trả về endpoint dạng ...:remote_port.

Các flag hay dùng:

  • -p, --port: cổng service local
  • -s, --sub-domain: tên public alias
  • --protocol: tcp hoặc http (mặc định tcp)
  • --public-domain: domain base hiển thị endpoint
  • --public-port: ép port public cụ thể (nếu muốn)
  • --machine-id / --machine-name: chọn machine
  • --frpc-server, --frpc-server-port, --frpc-token: custom tunnel relay
  • --skip-frpc-check, --skip-frpc-start: kiểm soát chạy frpc
  • --json: in JSON
  • --config: chọn file config mapping

4.2 forward-list

Quản lý tunnel frpc local.

portland forward-list
portland forward-list --active
portland forward-list --delete -n 1
portland forward-list --stop-all

Lưu ý: tunnels frpc sinh bởi forward thường tạo file log tại $(tmpdir)/portland/frpc.

4.3 mesh

Tương tác machine + ports (interactive).

portland mesh --base-url http://127.0.0.1:8787 --machine-name my-laptop

Flags quan trọng:

  • --machine-name, --machine-id
  • --labels
  • --auto-select, --reconnect, --skip-join
  • --auto-start-daemon
  • --base-url, --admin-token, --machine-token
  • --tailscale-socket, --tailscale-binary

4.4 start

Start proxy từ mapping đã lưu trong config.

portland start --active
portland start --name frontend

4.5 kill

Kill local process theo port, pid, hoặc cả hai.

portland kill --port 3000
portland kill --pid 12345
portland kill --port 3000 --pid 12345
portland kill --port 3000,3001 --pid 12345,12346
portland kill --port 3000 --signal SIGKILL

Flags quan trọng:

  • --port: 1 port hoặc danh sách port phân tách bằng dấu phẩy
  • --pid: 1 pid hoặc danh sách pid phân tách bằng dấu phẩy
  • --signal: signal gửi tới process, mặc định SIGTERM

Ghi chú:

  • Nếu truyền cả --port--pid, CLI sẽ hợp nhất danh sách PID rồi kill một lần.
  • CLI tự bỏ qua PID của chính tiến trình portland.
  • Khi dùng SIGTERM, helper sẽ chờ ngắn rồi fallback SIGKILL nếu process chưa thoát.

4.6 export / import

Backup và restore mapping.

portland export -o mappings.json
portland import -i mappings.json
  • export mặc định ghi vào file mappings.json cùng thư mục config nếu không truyền -o.
  • import mặc định đọc từ mappings.json cùng thư mục config nếu không truyền -i.

6) Cách thao tác nhanh

# 1) Expose service
portland forward -p 3000 -s app --base-url http://127.0.0.1:8787 --admin-token <admin_token>

# 2) Kiểm tra tunnel đang chạy
portland forward-list

# 3) Giải phóng local port nếu bị chiếm
portland kill --port 3000

# 4) Dừng nhanh tất cả tunnel
portland forward-list --stop-all