pattan पत्तन
ports & tunnels

pattan

पत्तन · “port, harbour”

The ports your dev servers listen on, Docker's and the tunnels that make them public, in the terminal: Enter opens one in the browser.

सर्वकर्माणि मनसा संन्यस्यास्ते सुखं वशी ।
नवद्वारे पुरे देही नैव कुर्वन्न कारयन् ॥

Master of itself, the embodied one rests at ease in the city of nine gates. Bhagavad Gītā 5.13
v0.2.0 latest3 releases1 decisions recordedMIT license

#pattan

Pattan (पत्तन) is Sanskrit for "port, harbour": where your connections come in.

The ports your dev servers listen on, Docker's published ports, and the tunnels that make them public, in the terminal. Enter opens localhost:port in the browser.

pattan (पत्तन) is Sanskrit for a harbour: where things come in and go out.

 Dev servers 5   All listening 13   Tunnels 1   Docker 4                    󰒋 pattan
╭─ Dev servers · 5 ───────────────────────────╮╭─ :5173 · vite ──────────────────────────╮
│ PORT     APP          PROJECT        STATUS  ││ OnAds · Dashboard                       │
│▌:5173 󰖟  vite         onads/apps/web ● 200 OK││                                         │
│ :4000    express      onads/apps/api ● 404   ││ URL        http://localhost:5173        │
│ :4321    astro        onads/apps/docs● 200 OK││ also on    http://192.168.1.12:5173     │
│          FROM DOCKER                         ││ process    node (pid 48211)             │
│ :5432    postgres     onads-postgres-1 ● tcp ││ tmux pane  main:2.1 · claude            │
╰──────────────────────────────────────────────╯╰─────────────────────────────────────────╯
 ports   j/k move   ↵ open in browser   y copy URL   g its tmux pane   t share   x stop

pattan's Dev servers tab, filtered to one project: a Vite and a Python dev server with their HTTP status, the project's Docker ports below, and the selected server's process, command and folder

Screenshots use made-up demo projects.

#What it shows

t on a port starts a tunnel to it with any tool you have installed (ngrok, cloudflared, tailscale funnel, localtunnel, bore). It runs on its own, keeps running after pattan quits, and logs to ~/.local/state/pattan/<tool>-<port>.log.

Everything refreshes every 2 seconds; the HTTP check every 10.

#Keys

pattan uses the vim grammar every Vayu tool shares (vyakarana): in NORMAL, keys are commands and typing changes nothing; / starts INSERT to filter (Esc goes back and keeps the filter). Space is the leader: press it and a box lists what can follow (Space y copies, Space d stops, Space g goes to, Space t switches tabs...). Space Space searches every action, ? shows every key. Counts work (5j, 3gg). Anything that stops a server or a tunnel asks first, and only y says yes.

Keys that moved say where they went for one release: t → Space a t, T → Space g t, K (force stop) → Space d k, a → Space t a, on a tunnel R → Space i r and i → Space i i. g now starts g g; the tmux pane is Space g p. Tabs are H / L (Tab and h / l too); 1–4 are counts now, the tabs are Space t 1–4.

**Everywhere**
KeysWhat it does
j or DownMove to the next port
k or UpMove to the previous port
g g or HomeJump to the first port (5gg: the fifth)
G or EndJump to the last port (5G: the fifth)
Ctrl+d or PgDnScroll half a page down
Ctrl+u or PgUpScroll half a page up
L or TabSwitch to the next tab
H or Shift+TabSwitch to the previous tab
/ or Space f fSearch the list by port, app, project or URL (filters it)
r or Space rRescan the ports now (it also rescans every 2 s)
? or Space ?Show every key of this view
q or Space qQuit
EscGo back one step: clear the filter, then quit
Space SpaceSearch every action and run one (the palette)
Space tTabs…
Space t d or Space t 1Switch to Dev servers
Space t a or Space t 2Switch to All listening (every port)
Space t t or Space t 3Switch to Tunnels
Space t k or Space t 4Switch to Docker
While typing
EscStop typing and keep the filter (back to NORMAL)
Ctrl+j or Down or Ctrl+nMove to the next port while typing
Ctrl+k or Up or Ctrl+pMove to the previous port while typing

On a port

KeysWhat it does
EnterOpen localhost:port in the browser
o or Space o bOpen localhost:port in the browser
y or Space y uCopy the URL
Y or Space y lCopy the URL other machines on your network can use
d d or x or Space d sStop the server (asks first; a container is stopped with docker stop)
Space aAdd…
Space a tStart a tunnel to the port, to share it (ngrok, cloudflared, tailscale funnel...)
Space dDelete…
Space d kKill the server at once (SIGKILL; asks first)
Space d tStop the port's tunnel (asks first)
Space gGo to…
Space g pGo to the tmux pane the server runs in
Space g tGo to the port's tunnel in the Tunnels tab
Space yCopy…
Space y pCopy the public URL of the port's tunnel

On a tunnel

KeysWhat it does
Enter or Space o bOpen the tunnel's public URL in the browser
o or Space o lOpen the local server the tunnel points at
y or Space y pCopy the public URL
JMove to the next of the tunnel's last requests (ngrok)
KMove to the previous of the tunnel's last requests (ngrok)
d d or x or Space d tStop the tunnel (asks first)
Space iInspect…
Space i rSend the selected request through the tunnel again (ngrok replay)
Space i iOpen ngrok's request inspector in the browser
Space yCopy…
Space y uCopy the local URL the tunnel points at

#Install

Needs Linux with ss (iproute2). Docker, tmux and the tunnel tools are optional: pattan uses what's there.

curl -fsSL https://raw.githubusercontent.com/Theyashsawarkar/pattan/main/install.sh | bash

downloads the release binary (or builds it with Go) into ~/.local/share/pattan and links ~/.local/bin/pattan. Or make install (PREFIX, DESTDIR), or go install github.com/Theyashsawarkar/pattan/cmd/pattan@latest.

#As a tmux plugin

set -g @plugin 'Theyashsawarkar/pattan'

prefix P opens pattan in a popup; P inside closes it. Without pattan on your PATH, the plugin builds it with Go the first time.

OptionDefault
@pattan-keyPthe key after the prefix; none binds nothing
@pattan-width / @pattan-height90% / 88%popup size
@pattan-title pattan popup title
@pattan-launcheryour own popup command instead of display-popup; it gets display-popup's arguments (-E -d DIR -T TITLE CMD)

To open it from a status-line click, open a popup that runs ~/.tmux/plugins/pattan/scripts/pattan-run --client '#{client_name}'.

#Command line

pattan                 the screen
pattan list            the dev servers' ports: "5173 vite onads-super/apps/web"
pattan list --all      every listening port
pattan tunnels         the tunnels: "ngrok https://… -> :5173"
pattan --version

#Colours

pattan follows varna's desktop theme (~/.local/state/varna/palette.json, a tools.pattan pick if the theme has one) and changes live with it; without varna it is Catppuccin Mocha. Icons need a Nerd Font; NO_NERD_FONT=1 turns them off.

#Privacy

pattan reads /proc and ss, asks your own ports over localhost, and talks to ngrok's and cloudflared's local APIs. Nothing leaves the machine unless you start a tunnel, which makes that one port public.

#License

MIT