Files
Your content root is one flat folder of plain JavaScript, mirrored to the server as-is (to
/srv/porthoster). The broker decides what to open purely from the names of the
top-level files. This page is the complete set of rules — what counts as an entry
point, what is ignored, and what merely rides along.
The layout
~/Developer/LIVE/Port/ content root → /srv/porthoster
echo.tcp.7000.port.js entry point: TCP :7000
echo.tcp.7000.port.json access manifest for the handler beside it
metrics.udp.9125.port.js entry point: UDP :9125
relay.tcp.4000.port.js entry point: TCP :4000
lib/ supporting code — synced, opens no port
framing.js imported by handlers
codec.js
_relay.tcp.4001.port.js ignored: leading _ (local only)
.git/ ignored: dotfile
.notes.md ignored: dotfile
Path patterns
| Pattern | Role | Synced | Opens a port |
|---|---|---|---|
<name>.tcp.<port>.port.js (top level) | TCP handler | Yes | Yes — TCP on <port> |
<name>.udp.<port>.port.js (top level) | UDP handler | Yes | Yes — UDP on <port> |
<name>.<proto>.<port>.port.json (top level) |
Access manifest | Yes | No |
Any other .js / file / sub-folder | Supporting code | Yes | No — imported, never a listener |
| A handler-named file not at the top level | Supporting code | Yes | No — only top-level names are entry points |
_* (leading underscore, anywhere) | Ignored | No | No |
.* (dotfile, anywhere) | Ignored | No | No |
Naming rules
- Suffix. An entry point ends in
.port.js. The tokens immediately before it —.tcp.<port>or.udp.<port>— carry the protocol and the port. - Protocol token. Exactly
tcporudp, lowercase. No other transport is recognised. - Port token. An integer
1–65535. It is authoritative — the number in the name is exactly what the broker opens. - Name token. The leading
<name>is a label for logs andctx.name. Keep it to letters, digits,-and_(not as the first character — a leading_means "ignore"); avoid dots inside it, since dots delimit the grammar. - Top-level only. Only files directly in the content root are entry points. The same name in a sub-folder is treated as supporting code and opens nothing.
- One per protocol+port. Two files claiming the same protocol and port conflict; the later one is refused and logged.
Ignore rules
Two prefixes are never synced and never opened, so the folder is safe to keep under version control and full of scratch work:
| Prefix | Effect |
|---|---|
_ | Develop-in-place. _relay.tcp.4001.port.js stays on your
machine. Drop the underscore to go live; add it back to take a live port offline. |
. | Dotfiles — .git, editor state, notes — are left on your
machine entirely. |
Sidecars & supporting files
Beside a handler you may place a <name>.<proto>.<port>.port.json
access manifest — it configures that handler and opens no port of
its own. Everything else in the folder — libraries in sub-folders, helper modules, data files — syncs
and is importable, but is only ever reached through a handler. Supporting code has no naming
rules beyond the ignore prefixes.
Reserved ports
Some ports the broker will not bind, even if you name a handler for them, because they belong to the
box itself — the sync API's localhost port and SSH on 22 — or need capability the broker
deliberately doesn't hold. A handler that asks for a reserved port is refused and logged rather than
opened. The exact reserved set is still being fixed; see Installation →
Server (Q7).