# Guide: Deploying an App

Once you've built, graded, and styled your app locally (see **[Build, Grade & Style Before You Deploy](./test-before-deploy.md)**),
deploying is registering your app's bytes on-chain — a one-time cost, after which anyone renders it for free forever.

## The steps

1. **Compile** your composition to get its bytes and hash.
2. **Register** the bytes in the registry the chain's `RenderRouter` reads (one transaction). Ask the router:
   `RenderRouter.registry()` returns it — on Sepolia that is `ComponentRegistry`, on Robinhood and Arc
   `ComponentRegistryFast`. Bytes registered in any other registry deploy without error but cannot render
   ("execution reverted"). The hash is now a live, renderable app. If `register` reverts with `AlreadyRegistered`
   (`0x77caf672`), those exact bytes are already there: the app is already live and there is nothing to pay.
3. **(Optional) Name it** — register a subname (`myapp.chainrender.eth`) so it's resolvable by name. See
   **[ENS Names & Integration](./ens-integration.md)**.
4. **(Optional) Seed a theme** — if you tuned a custom theme, seed its CSS on-chain and point your app at it.
5. **Verify** — render the deployed hash against multiple RPCs and confirm byte-identical output. See
   **[Contracts → Verifying](../contracts/verifying.md)**.

## Deploying from the builder

The **[Visual Builder](../resources/visual-builder.md)** does step 2 for you: it reads `RenderRouter.registry()` for
the selected chain, puts that address in its Registry field, and refuses to deploy while that read is pending, has
failed, or disagrees with the field. It checks `exists()` before writing, so bytes already on-chain are skipped at no
gas. An Enhanced (VERSION_5) project deploys only to a chain whose router has the VERSION_5 interpreter. Each deploy
goes into the builder's History with its full hash, a Copy button and an **Open in viewer** link.

## Sharing it

The viewer link `chainrender-viewer.html?chain=<id>&app=<hash>` renders the app from chain for anyone. The short link
`https://chainrender.org/app/?c=<id>&h=<hash>&n=<name>` works for any deployed component, and an app listed in the
site's catalog or submitted through the builder also gets its own page `/app/<hash>/`, with a preview card for
social posts. The viewer's and Explore's Share buttons hand out the page when it exists and the short link otherwise
(`CRShare.appLink`).

## What you pay for

- **Registering bytes:** gas, once, proportional to app size (stored via SSTORE2 — cheap and permanent).
- **Rendering:** nothing, ever. It's a `view` call.
- **Naming:** a refundable stake (spam cost, not a fee).
- **Theme changes:** nothing at render time; a one-time seed only if you commit a new default theme.

## Multichain

Because rendering is deterministic and content-addressed, the same app has the same hash and output on any EVM
chain. To deploy across chains, register the same bytes on each; a chain-id-aware viewer resolves the right
deployment. (Portability, not bridging — each chain holds its own immutable copy.)

## Updating later

You don't mutate a deployed app — you publish a **new version** through the versioned-name registry (timelocked,
observable). See **[Update a Deployed App](./update-app.md)**.

## Related
- **[Contracts → Architecture](../contracts/architecture.md)** · **[Contracts → Verifying](../contracts/verifying.md)**
- **[Submitting to the Catalog](./submitting.md)** — name it and list it in Explore.
