Section: Self-hosting Order: 300 # Build & deploy Orbit builds to a **static** `dist/` you can serve from any web server. ```sh npm run build # → dist/ (index.html + hashed assets + config.json + sw.js) ``` ## Serving Serve `dist/` under a path — conventionally `/app/`. The build's `vite.config.ts` sets `base: '/app/'`. Example nginx: ```nginx location /app/assets/ { root /var/www/site; expires 7d; add_header Cache-Control "immutable"; } location = /app/index.html { root /var/www/site; add_header Cache-Control "no-cache"; } location /app/ { root /var/www/site; try_files $uri $uri/ /app/index.html; } ``` - **Hashed assets** are immutable → cache forever. - **`index.html`** is `no-cache` so new builds load immediately. - **`config.json`** is served *network-first* by the service worker, so edits apply without a rebuild. ## Origin allow-list The IRC WebSocket server must allow the **Origin** Orbit is served from (e.g. InspIRCd ``). Otherwise the socket is rejected on connect. ## Service worker On each deploy, bump the cache version in `public/sw.js` (`const CACHE = 'app-vN'`). The worker calls `skipWaiting()` + `clients.claim()` and fires `controllerchange`, so existing PWA installs auto-reload to the new build. For an automated pipeline, see [Push-to-deploy](/docs/push-to-deploy/).