# Running a Saved App

A saved app runs by being [published](/insulin/custom-apps/publishing/). Once a version is live, opening the app shows the running app in the **runner window**: the live app is embedded directly in the window (in a credentialless iframe), so you use it without leaving Insulin.

If the app has not been published, the runner window says **Not published yet** — *Publish a saved version from the builder to give this app a live URL* — instead of a blank screen, and offers **Open in builder** to someone who can edit the app. Publish a saved version to bring it to life. Once it runs, **Reload app** in the window's title bar reloads it.

Where an app cannot be embedded, the runner window shows the app's live URL with an **Open app** button that opens it in a new tab instead.

A [Console-only](/insulin/custom-apps/publishing/#who-can-open-a-published-app) app opens in the runner window under your own Fours sign-in — the window shows *Opening* and the app's name while it signs you in. This needs a browser that supports credentialless iframes, such as Chrome or Edge; in another browser the runner window asks you to use one of those. Opening a Console-only app's address directly takes you to the app inside the Fours console instead, at the page you opened — its path and query — or at the app's home if the address isn't plainly one of the app's own pages. Your access is re-checked every few minutes, so if it is removed while the app is open, the app stops within about five minutes with *Your access to this app ended. Open it again.*

While a publish that changes how the app is reached — its access setting or its address — is waiting to be confirmed, the runner window shows **Deployment is not confirmed** instead of the app; check the publish status in the AppBuilder before opening it.

## Running apps from the Fours console

Your apps also run in the classic Fours console, without switching to Insulin. **Insulin Apps** in the console's sidebar, below **Analytics**, lists the apps you can use: **Pinned** first, then **Organization apps** and **Personal apps**, with a **Search apps** box. Each card says whether the app is **Live** or **Not published**, and its info button shows the app's owner, your role, its type, who can open it (**Public**, **Team only** or **Not published**) and when it was last edited. **Build an app**, shown to anyone allowed to create one, opens the AppBuilder in Insulin.

The pin on a card is the same pin as the app's tile in the Insulin [Dock](/insulin/getting-started/desktop/#the-dock): pin an app in either place and it is pinned in both.

Click a card to run the app on its own page, the same way the runner window does — the same published URL, and the same console sign-in for a Console-only app. A draft opens only for someone who can edit it. The page has **Reload app**, **Pin** or **Unpin**, and — if you can edit the app — **Edit in Insulin**, which opens the AppBuilder on it. The apps you have pinned, and any others you have opened in this browser, show as tabs above the app, so you can switch between them; closing a tab doesn't unpin the app. **All Insulin Apps** takes you back to the list.

## Data an app keeps for itself

An app can keep data of its own. Ask the builder for an app that has to remember what people enter — a request tracker, a to-do list, an intake form — and it gives the app a database of its own, separate from every other app's. The database is created the first time the app needs it; there is nothing to set up.

*Diagram: An app's database is created when it first needs one; each change reruns the app's migration, and deleting the app schedules the database's removal.*

- The app first needs to store something → Its own database is created
- Its own database is created → You save new code, or restore a version
- Its own database is created → You delete the app
- You save new code, or restore a version → The app's migration runs again (Existing data is not automatically reset; the migration may change it)
- The app's migration runs again (Existing data is not automatically reset; the migration may change it) → You save new code, or restore a version: next change
- You delete the app → App and data unavailable (Database removal scheduled)

What happens to that data as the app changes:

- **Saving new code** — existing data is not automatically reset. The app's migration, its own setup step, runs again on each save that changes the code and may change the data already stored.
- **A migration that fails** — the save is refused and the app keeps its previous version, but any database changes the migration made before it failed are not undone.
- **Restoring a version** — brings back that version's code, not its data (see [App History and Restore](#app-history-and-restore)).
- **Deleting the app** — makes the app and its data unavailable, and schedules removal of its database. Treat the data as gone.

Once the app is published, **Settings → Database** lets app admins — the app's **Owner** or an **Admin** on it — browse that production database read-only: pick a table and page through it 25 rows at a time (*Read-only production data. Pages reflect live data. Binary values are omitted and long text is shortened.*). Anyone else sees *Only app admins can inspect production data.*, and until the published app has a database the section says *No production database is available yet.*

This database is separate from your Fours data, which a published app reaches through the Fours API — see [How a published app reaches your Fours data](/insulin/custom-apps/integrations/#how-a-published-app-reaches-your-fours-data).

## App History and Restore

The builder header carries a **History** button, which opens the **App History** dialog, titled with the app's name.

Every save that changes the app's **code** is snapshotted. Saves that do not are deduplicated away — saving the same source again, or editing only metadata, does not mint a version — so the list is a record of the app actually changing rather than of how often you pressed Save. The newest **50** versions per app are kept.

From the list you can **preview** any version, then **Restore** it behind a two-step confirmation.

**Discard draft to vN** puts that saved version back in the editor without creating a new version. The AppBuilder's working draft is shared by everyone editing the app, so this replaces it for every collaborator — the confirmation reads *This replaces the shared draft for every collaborator with vN. Unsaved edits will be lost. No new saved version is created; the live app stays as it is.* Click **Confirm discard** to go ahead.

:::note
**Restore rolls forward; it never deletes.** Restoring creates a **new** version whose source is the snapshot's, and that new version is saved like any other. Nothing between the snapshot and now is removed, so a restore is itself undoable by restoring the version you were on.

A restore brings back the snapshot's code, not its data: data the app has stored for itself is not rolled back or automatically reset, and the restored version's migration runs again and may change it (see [Data an app keeps for itself](#data-an-app-keeps-for-itself)).
:::

App History is part of the AppBuilder, so only someone with **Editor** or above on the app can open it; a **User** or **Viewer** can't see an app's versions or their changes.

## When an app fails to render

A first launch shows its startup steps, as described in [The Live Preview](/insulin/custom-apps/building/#the-live-preview). If the app reports an error, stalls while compiling, or is not ready while the builder is changing it or after it had already loaded once, the Preview surface covers it with a placeholder instead of a blank screen or a half-loaded page. While the builder is still working on your request, it reads **Your app is taking shape** — *Insulin is working on your changes. Your preview will appear here when it's ready.* Otherwise it reads **Your preview needs a moment** — *Your app isn't ready to preview yet. Try reloading, or ask Insulin to help in the chat.* — with a **Reload preview** button once the preview has an address to reload. When the runtime reported an error, **Technical details** shows it.
