# Preview

The Preview tab shows the web app you are building, running inside your workspace. Whatever listens on port 8080 in your workspace appears here, behind the same sign-in as the rest of the workspace. Change the code, yourself or through the agent, and the result shows up in the tab.

The Preview tab showing a running web app, with its toolbar 1 2 3
The Preview tab, with its toolbar buttons numbered

# The toolbar

# Button What it does
1 Copy URL Copies the preview's address, so you can open it in another tab or window. Only you can open it: it sits behind the workspace's sign-in.
2 Reload Reloads the page from scratch. The app's in-page state, such as form input or client-side navigation, is reset.
3 Open in a new window Opens the preview in a window of its own, for example to see it at full width or next to the Terminal.

# Start a dev server

  1. Start your dev server on port 8080, listening on 127.0.0.1. Ask the agent to do it, or run it yourself in the Editor's terminal. For example:

    npm run dev -- --host 127.0.0.1 --port 8080
    # or, for a folder of static files:
    python3 -m http.server 8080 --bind 127.0.0.1
  2. Open the Preview tab.

Until something listens on port 8080, the tab shows a placeholder that checks again every 5 seconds. Your app appears as soon as the server is up, without a manual reload.

# How it behaves

  • Live reload works. Dev servers that update the page as you save, such as Vite, webpack or Next.js, do so in the preview too.
  • Links and assets work without configuration. Your app is served under /preview/, and links in the page that start at the root, such as /assets/app.js, are rewritten to stay inside the preview. Most frameworks need no base-path setting.
  • The app keeps its state while you switch to other tabs and back.
  • The agent can test it. The Browser runs inside the same workspace, so the agent can open your app at localhost:8080 and check it works.
  • One port, one preview. The port is fixed at 8080, so one app is previewed at a time. Binding to 0.0.0.0 also works but exposes nothing more: the preview is the only way in from outside.

# Security

  • You are responsible for what you run in the preview. The app runs inside your workspace with your access: your credentials, the API keys available to the workspace, and your files. It also shares an origin with your workspace's own interface, so a page you preview can make requests on your behalf.
  • Only run code you trust. Code from an unknown source, such as an unfamiliar dependency or script, can read the workspace's environment variables and send them elsewhere. Treat a previewed app like software you would run on your own computer.
  • The risk stays within your workspace. A previewed app cannot reach another user's workspace or data. Each workspace is isolated, and the preview only reaches the dev server in your own.

Terminal
../terminal/
Browser
../browser/
Editor
../editor/