Self-hosting
Deploy on Render
On this page
The fastest path to your own Pug Network instance: connect a fork to Render, set one option, and you have a live deployment in a few minutes. No database, no secrets, no extra services.
The repository is a monorepo. The JavaScript implementation lives in
the pugnetwork-js subdirectory. You must set
Render's "Root Directory" to pugnetwork-js or
Render will not find render.yaml or package.json.
First-time deploy with a Render Blueprint
- Fork or connect the
pugnetwork-socketrepository to your Render account. - In the Render dashboard, click New → Web Service.
- Select the repository.
- Set Root Directory to
pugnetwork-jsbefore saving. This is the critical step. - Render reads
render.yamlfrom inside that subdirectory and auto-fillsnpm installandnpm start. - Confirm the environment variables (see below — there are only two, and one is automatic).
- Click Create Web Service.
Every subsequent git push to the connected branch triggers
an automatic redeploy.
Migrating an existing service
If you already have a Render service pointing to the repository root from before the monorepo reorganization, do this once:
- Open the Render dashboard and select your service.
- Go to Settings → Build & Deploy.
- Find Root Directory and set it to
pugnetwork-js. - Click Save Changes.
- Trigger a manual deploy (or push a commit) to confirm the new root is used.
The build log should then show:
==> Running 'npm install' from /opt/render/project/src/pugnetwork-js
No changes to render.yaml, package.json, or
server.js are required — the file contents are byte-identical
to before the move.
Environment variables
| Variable | Required | Notes |
|---|---|---|
NODE_VERSION |
Yes | 20 (matches render.yaml). |
PORT |
No | Render injects this automatically. |
That's everything. There is no database to provision, no API key to set,
no S3 bucket to wire up. If a DATABASE_URL is still set on
an existing service from before the metrics endpoint was removed, it is
silently ignored — delete it from the dashboard for tidiness.
Render-specific notes
- TLS: Render terminates TLS at the edge. The Node.js process speaks plain HTTP internally. No certificate configuration is needed inside the app.
- Zero-downtime deploys: Render spins up the new instance before tearing down the old one, so deploys are seamless. The Pug Network JS server handles
SIGTERMby gracefully closing live rooms before exit. - Free tier: The service sleeps after inactivity. Use a paid instance or an external uptime monitor to keep it warm.
- Custom domain: Pug Network does not hardcode any domain — point any hostname at the Render service and it works as-is.
Local development
cd pugnetwork-js
npm install
npm run dev
Server starts on http://localhost:3000. No database, no
secrets, no external services. The build is fully self-contained.
Considering the Go build instead?
If you want zero runtime dependencies, a single static binary, and the option to run on OpenBSD with kernel-enforced sandboxing, see Self-host the Go build.