> ## Documentation Index
> Fetch the complete documentation index at: https://archie.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Previews, sharing, and publishing

> Every branch has its own preview. Share a frozen copy of a commit with a link, connect a branch to a backend environment, and choose the branch and commit that go live when you publish.

Branches let you see, share, and ship code in separate steps. Each branch has its own preview. You can share a frozen copy of a commit. You decide when to publish the Frontend or deploy a service.

**Nothing happens automatically when you save, and nothing happens when you merge.**

## Previews per branch

Every branch of the Frontend has its own **preview**: the app running with the code of that branch. When you switch branches, the preview switches with you. While Archie applies your changes, you see **Updating preview of *branch***. If the preview could not refresh, you see **The preview of *branch* did not update**.

* **Deleting a branch** removes its preview. What you already published stays available to publish again.
* **Sleeping previews.** Your organization can have a limited number of previews running at once. A preview with no activity for a while goes to sleep. Open it to wake it, and the least active preview goes to sleep instead.

## The environment of a branch

A preview needs data, and data lives in an [environment](https://archie.com/docs/backend/environments.md). A new branch uses the backend environment of the project until you change it.

To connect a branch to a different environment:

1. Switch to the branch and open the branch menu.
2. In **Backend**, select **Change**. This opens the backend environment control in the header.
3. Pick an environment. The dialog shows readiness checks for it and tells you if the switch is blocked.
4. Confirm **Connect *branch* to *environment*?** with **Connect**.

The preview of that branch connects to the environment and rebuilds. **Other branches are not affected.**

You cannot change the environment of a protected branch. Only people who can edit the Frontend can change it.

> [!NOTE]
>
> Two branches connected to the same environment share its data. See [Branches and environments](https://archie.com/docs/frontend/branching.md#branches-and-environments).

## Share a preview

A **share link** lets anyone see your work in progress without access to the project. Owners and Editors can create links from the Frontend.

1. In the project header, select **Share**, then **Share preview**.
2. Select **Create new preview link**.
3. In **Create preview link**, check the details:
   * **Branch @ commit** is the latest commit of the branch you are on.
   * **Backend** is the environment the link reads data from.
   * **Name** defaults to *branch*@*commit*. You can change it, for example to *Client demo*.
   * **Expires** is 1 hour, 24 hours, 3 days, 7 days, or a custom date and time.
4. Select **Create link**. Archie copies the link so you can share it.

**A link is a snapshot of a branch at a commit.** It does not change as you keep editing. The code is frozen, but the data is live from the environment the branch is connected to. Anyone with the link can open it until its expiration date. After that, the link no longer opens. Comments are off on snapshot links.

A few details:

* While Archie builds the snapshot, you see **Building…**. Keep the window open until it is ready. Archie creates the link automatically. If the build fails, select **Retry**.
* If the branch has edits that are not in a commit yet, the dialog tells you which commit it will share.
* Right after a merge into a protected branch, sharing waits until the branch finishes updating.
* To stop a link, select **Revoke** and confirm **Revoke link**. Guests lose access within seconds. If it was the only link to that snapshot, Archie deletes the snapshot too.
* Shared links count toward the capacity of your organization's plan. When you reach it, you can remove a link or add capacity.

## Publish the Frontend

Publishing is explicit. Select **Publish** in the project header to open **Publish site**: "Choose the branch and commit that go live."

| Field | What it does |
| - | - |
| **Branch** | The branch to publish. The one you are on is marked **you are here**. Protected branches are marked **Protected branch**. |
| **Commit** | The commit of that branch. It defaults to the latest, and you can search older commits. |
| **Live now:** | What is published today, and how this publish compares: for example "+2 commits over live", "Same commit as live", or "1 commit behind live". |
| **Destination** | The backend environment the published site reads data from, with **Change…**. |

If the site would read data from an environment that is not the root environment, **Publish** stays disabled until you type the name of the environment. This keeps you from publishing against the wrong data.

**Publications** lists earlier publishes with their status: **Live**, **Replaced**, **Failed**, or **Publishing…**. Select **Publish this again** to republish an earlier one. If the environment changed since then, the entry tells you what it read back then and what it will read now.

Who can publish depends on the **Who can publish** setting. See [Permissions](https://archie.com/docs/frontend/branching/permissions.md#who-can-publish-and-merge-into-protected-branches).

## Deploy a service

A Logic service is deployed from a branch and a commit to an environment. See [Branches in a Logic service](https://archie.com/docs/backend/logic/branches.md#deploy-a-service-from-a-branch).

## Next steps

* [Pull requests](https://archie.com/docs/frontend/branching/pull-requests.md)
* [The chat and branches](https://archie.com/docs/frontend/branching/chat-and-branches.md)
* [FAQ and troubleshooting](https://archie.com/docs/frontend/branching/faq.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.