nodejs service BETTERPORTAL v1.0.48

service-tunnels-proxy

betterportal/service-tunnels-proxy

Front-facing H3 tunnel service

service h3 tunnel

BetterTunnels

HTTP/HTTPS development tunnels using BSB, H3, AnyVali, websocket clients, Prisma, and PostgreSQL 18.

Dev Setup

npm install
copy .env.example .env
npm run prisma:generate
npm run build

Start PostgreSQL 18 with the included compose file when Docker is available:

docker compose up -d postgres
npm run prisma:migrate

Run the server:

npm run dev

Server startup goes through BSB. Do not start a standalone src/server.ts.

Run a tunnel:

npm run cli -- http 3300

Build the release CLI:

cd cli
go build -o ..\dist\btunnel.exe .

Notes

  • Default domain: tunnels.betterportal.dev.
  • Anonymous configured prefixes are ignored.
  • btunnel profile shows account defaults; btunnel profile set validation cookie|ip|none and btunnel profile set ttl 1..168 update them across CLI devices.
  • Authed accounts keep 24-hour IP/port URLs, junior accounts get stable short URLs and up to seven days, and senior accounts get stable unvalidated tunnels without expiry.
  • The H3/WS runtime is owned by the service-tunnels-proxy BSB plugin.
  • The release CLI lives in cli/ and builds to single-file Go binaries for Windows, Linux, and macOS.

Docker

Build the BSB runtime image with this plugin preloaded:

docker build -t better-tunnels:dev .

Run it with a production DATABASE_URL:

docker run --rm -p 8080:8080 -p 8081:8081 -e DATABASE_URL="postgresql://..." better-tunnels:dev

Swarm Deploy

On the server, build local images, run migrations, then deploy the stack:

docker swarm init
docker build -t bettertunnels-app:latest .
docker build -t bettertunnels-migrate:latest --target build .
docker build -t bettertunnels-caddy:latest -f Dockerfile.caddy .
docker stack deploy -c docker-stack.yml bettertunnels

app runs two replicas with start-first rolling updates. Caddy and Postgres are singletons on this one-node swarm. The stack reuses the original Compose volumes by external name.

Installation

Use as a dependency (client reference)
bsb client install betterportal/service-tunnels-proxy
Deploy as a service
bsb plugin install betterportal/service-tunnels-proxy
Node.js (npm)
npm install @betterportal/tunnels

Configuration

Configuration options for this plugin:

No configuration required

Events

Events available to clients of this plugin:

Fire and Forget

Emit these events with no response expected.

ws.fromOrigin fire-and-forget

Relay an origin websocket frame to the public websocket

proxy.response.body fire-and-forget

Stream an HTTP response chunk to the public client

proxy.response.end fire-and-forget

Complete a streamed HTTP response

proxy.response.error fire-and-forget

Fail a streamed HTTP response

Available Versions

v1.0.48 v1.0.47 v1.0.46 v1.0.45 v1.0.44 v1.0.43 v1.0.41 v1.0.40 v1.0.39 v1.0.38 v1.0.37 v1.0.36 v1.0.35 v1.0.34 v1.0.33 v1.0.32 v1.0.31 v1.0.30 v1.0.29 v1.0.28 v1.0.27 v1.0.26 v1.0.25 v1.0.24 v1.0.23 v1.0.22 v1.0.21 v1.0.19 v1.0.18 v1.0.17 v1.0.16 v1.0.15 v1.0.14 v1.0.13 v1.0.12 v1.0.11 v1.0.10 v1.0.9 v1.0.8 v1.0.7 v1.0.6 v1.0.5

Metadata