Preview development servers
Show a running development server in an iframe and control its route.
Startpod routes a supported development server through a browser-controlled preview URL.
Mount before spawning
Give Startpod the element that should contain the preview, then start the server:
startpod.mountPreview(document.querySelector("#preview-host")!)
const server = await startpod.spawn("npm", ["run", "dev"])Startpod creates the iframe, connects its request bridge, and renders the project when the development server is ready.
Use the managed relay frame
The managed preview also exposes navigation controls:
startpod.mountPreview(document.querySelector("#preview-host")!)
startpod.navigatePreview("/settings")
startpod.reloadPreview()Call unmountPreview() before removing the host element.
Make direct preview requests
Use requestPreview() for an HTTP client or test panel that needs to call the active server without iframe navigation:
const response = await startpod.requestPreview({
method: "GET",
url: "/api/health",
})
console.log(response.status)Set maxResponseBytes or an AbortSignal when user-controlled endpoints may return large or slow responses.