# Preview Links

Source: https://athas.dev/docs/previews

Share a local dev server or a cloud agent's running app with a temporary link.

Preview links put a development server on the web for a few hours, so a teammate or client can
open what you are working on without deploying it. Athas serves each preview on its own address,
`https://<random>.athas.run`, through Athas's own servers. You do not need to install a
tunnel tool or open a port on your network.

## Requirements

- Athas Pro
- Signed in to your Athas account

## Share a Local Server

1. Start your dev server, for example `bun dev` or `npm run dev`.

2. Open **Preview: Share Local Server** from the command palette.

3. Pick one of the detected ports or type the port your server listens on, then click **Share**.

4. Copy the link and send it.

Athas forwards each visit to `http://localhost:<port>` on your computer and sends the answer
back, so the preview works while Athas is open and your server is running. If Athas loses its
connection it reconnects on its own. The same dialog lists your active previews with how many
requests each one served, and lets you copy a link, open it, or stop it.

Signing out stops your previews. Closing Athas disconnects them and stops them when it can;
a preview it could not stop shows visitors that it is offline until it expires, and you can stop
it from the dialog the next time.

## Preview a Cloud Agent

While a [Cloud Agent](https://athas.dev/docs/cloud-agents) run is working, open the run and use **Preview port**
with the port of a server the agent started in its sandbox. The server must listen on `0.0.0.0`,
for example `npm run dev -- --host 0.0.0.0`. The preview stops when the run finishes.

## What Visitors See

The first time someone opens a preview in a browser, Athas shows a notice with your account name
that the page is a development preview, warns them not to enter passwords or payment details
unless they trust you, and links to report abuse. After they continue, they see your app.

## Limits

- Up to 3 active previews at a time
- Links expire after 8 hours
- Up to 10 MB per upload and 25 MB per response, and 30 seconds for your server to start
  answering
- A preview may carry 2 GB in total and is rate limited if it receives too many requests at once
- WebSocket connections are not forwarded, so hot module reload does not reach visitors. They
  see your changes when they reload the page.

## Privacy and Security

- Previews are only reachable through their random link. Anyone with the link can open the
  preview until it expires or you stop it.
- Previews live on a separate domain from athas.dev, so a previewed app cannot read your Athas
  session.
- Athas only forwards visits to the port you chose on `localhost`. It does not follow redirects
  to other addresses or reach other machines on your network.
- Visitors' IP addresses and Cloudflare headers are not passed to your server. Your server gets
  `X-Forwarded-Host` and `X-Forwarded-Proto` with the preview's address.
- Athas counts the requests and bytes each preview carries to enforce the limits, and keeps a
  record of your previews so abuse reports can be reviewed. It does not store the pages served.

**Warning:**

  Do not share previews of apps that hold real customer data or credentials. Anyone with the link
  can use the app as you would locally.

## Troubleshoot an offline link

Open `http://localhost:<port>` on the host first. Keep the local server and Athas running, or verify the cloud run is still active. Check expiry and request limits. If the app depends on WebSockets, the current preview transport does not forward them. Use [Browser](https://athas.dev/docs/browser) for a local-only preview.
