Servers
Development and runtime servers used by Webstir.
Overview
- Dev Web Server: Bun-hosted static server that serves built frontend assets, publishes watch status over SSE, and applies clean URLs with dev caching.
- Backend Runtime: runs the compiled backend entry (
build/backend/index.js) and is restarted after successful backend rebuilds. - Proxy: in
fullmode, the dev server proxies/api/*to the backend runtime.
See also: Engine and Services.
Dev Web Server
- Serves
build/frontend/**duringwatch. - Clean URLs:
/aboutserves/pages/about/index.html;/serves/pages/home/index.html. - Live reload: SSE endpoint notifies connected browsers after frontend rebuilds.
- Caching: static assets cache with short TTL in dev; HTML not cached.
- Logs: prints the frontend URL, and in
fullmode also prints the backend origin.
Backend Runtime
- Entry:
build/backend/index.jsproduced by the backend compile step. - Lifecycle: spawned by
apiorfullwatch; restarted on successful backend rebuilds. - Environment: receives
PORT,API_BASE_URL,NODE_ENV, and the activeWEBSTIR_MODULE_MODE. - Health: the default scaffold exposes
GET /api/health,GET /healthz, andGET /readyz.
Proxy Rules
- Path:
/api/*. - Method, headers, and body are forwarded to the backend runtime.
- Errors: if the backend is unavailable, the proxy returns a clear
502response.
Production
- Frontend publish artifacts live under
dist/frontend/**. - Backend publish output stays under
build/backend/**. - You can serve published assets with your own static host or CDN, and run the backend runtime separately when the workspace includes one.
Errors & Resilience
- Dev server survives frontend rebuilds and continues serving.
- Proxy returns actionable messages if the API is unavailable.
- Backend restarts are serialized so one successful rebuild replaces the current process cleanly.