# Building an App

Every app starts with a short interview that ends in a brief you approve. The AppBuilder's assistant then writes a real npm project, held on the server, and the preview runs it in your browser, so what you see is the working app rather than a mock.

---

## The Creation Interview

Creating a new app runs a four-step wizard — **Describe**, **Clarify**, **Theme** and **Plan** — before any code is generated. The pattern is **AI proposes → you decide → AppBuilder builds**, and nothing is created until you click **Build my app** on the Plan step.

| Step | What happens |
|------|--------------|
| **Describe** | Answer *What are you building?* — one sentence is enough, up to 4,000 characters — or start from an example: **Deal desk approvals**, **Partner referrals**, **Renewal follow-ups** or **Team requests** (**Undo** brings back what you had written). The model picker sits in the same box: choose the **AI model** that builds the app, or leave it on Auto. Then answer *Who is this app for?*, which can't be changed once the app is created: **Other people will use it too** makes an **Organization app**, which everyone in your organization can see and run from the start (you can change who has access in **Share**), and **Only I will use it** makes a **Personal app**, which can never be shared. If your organization's AI is paused, the step says why at the top, with the same banner as **Settings → Billing** (see [When AI pauses](/insulin/billing/when-ai-pauses/)), because building an app needs AI from the first step. |
| **Clarify** | Under *A few questions about* your app, the AI restates your idea and who it is for, above the words you wrote. If it misread you, **Not quite right?** lets you say what to change, then **Update**. Choose *What kind of app?* — one option is marked **Recommended** — and answer the AI's questions (at most two, and none when your idea is already clear). Each offers two or three choices plus **Something else…** for your own words. |
| **Theme** | *Pick a theme* for the app — **Salesforce** (navy, sans, sharp corners), **Stripe** (indigo, sans, rounded) or **Editorial** (green, serif, rounded), each previewed in the shape of the app you described. The one that suits that kind of app is marked **Recommended**; **Skip this part** leaves the look out of the brief. You can restyle the app once it is built. |
| **Plan** | Check or change the **App name**. Under **What happens next** — *AppBuilder sets up your app, and the builder plans the first release from this brief, then builds it. You can keep asking for changes after that.* — **See the exact brief** shows the text the builder starts from: your idea in your own words, what the app is and who it is for, your answers on Clarify, and the theme you picked. The step asks the AI nothing more, so there is no wait between Theme and Plan. |

Click **Build my app** on the Plan step to create the app. The AppBuilder sets up the app's own npm project — its `package.json`, framework configuration, and editable source — and the builder's first turn plans the first release from your brief, then builds it as a complete, working first version. You can inspect and change every generated file afterward in the AppBuilder.

*Diagram: Describe, Clarify, Theme and Plan end in a brief; Build my app builds it, and publishing a saved version gives a live URL that runs in the runner window.*

- Describe (What are you building? AI model and ownership) → Clarify (The AI's reading and its questions)
- Clarify (The AI's reading and its questions) → Theme (Pick a look, or skip it)
- Theme (Pick a look, or skip it) → Plan (App name and the exact brief)
- Plan (App name and the exact brief) → Approve the brief
- Approve the brief → Build (AppBuilder sets up the npm project on the server; the builder plans the first release and builds it): Build my app
- Build (AppBuilder sets up the npm project on the server; the builder plans the first release and builds it) → Publish (Production URL + owner secrets): publish a saved version
- Publish (Production URL + owner secrets) → Run (Embedded in the runner window): live URL

Once the first build finishes, you keep working on the app in the AppBuilder — asking for changes in the assistant chat, editing the source, and saving new versions.

### Discuss before you change

The builder no longer has a separate discussion mode: the **Discuss** toggle and its **Implement this** button have been removed, so every message you send goes to the builder as a request it can act on. To point a change at one part of the app, [draw an annotation](#mark-an-area-of-the-preview) on the preview.

Typing `/` in the builder's composer lists the builder's own guides — on integrations, the Fours API, app structure, server routes, the database, interface design, secrets and configuration, access and users, debugging, publishing, runtime and dependencies, and analytics — building reports on your revenue, marketplace, co-sell and account data. The builder reads the one a request calls for on its own; name one, such as `/integrations`, to point it there.

### Mark an area of the preview

Once the app is running in the preview, the Preview toolbar has a **Draw annotation** button. Turn it on and drag a box over the part of the app you mean — the preview prompts *Drag a box over the part you mean. Esc to stop.* The area and the elements inside it are attached to your next message as a reference, so you can write "make this chart taller" or "change this label" instead of describing the whole screen. Each box you draw replaces the last one, and the reference shows above the composer, where you can remove it. Press **Esc** to stop drawing and clear it.

### Choose the AI model

The builder includes a model picker — the sparkle icon in the composer — so you can choose which model generates the app. You first choose it on the wizard's **Describe** step, or leave it on Auto, and can change it here later. Models are **grouped by provider**, and you can type in the picker to search them. The grouping is driven by the server rather than a fixed list — connect another provider, such as [Cloudflare Workers AI](/integrations/cloudflare/) or [DigitalOcean GradientAI](/integrations/digitalocean/), and its group appears in the picker. The Fours-hosted models have a group of their own. Which models appear in the groups depends on the app's **ownership**:

- **Organization apps** list **Your key** rows built from your organization's own connected provider keys (BYOK). Only providers you have connected contribute rows; connect a provider to add its models.
- **Personal apps** list **Your key** rows for the providers *you* have connected — a personal app never reads your organization's keys. Connect a provider to add its models.

Ownership decides only **whose** BYOK keys are listed. **Suger's key** rows, the Fours-hosted models (the label still carries Fours' former name), are offered to personal and organization apps alike, so you can build an app before connecting any provider of your own.

An organization administrator can also constrain the picker, in two ways that behave differently:

- **Turning the Fours-hosted fallback off** removes every **Suger's key** row for everyone in the organization, in both kinds of app. Only your own connected keys remain.
- **Restricting which providers may be used** removes the **Suger's key** rows served by a provider that is not on the allow-list. Your own **Your key** rows are still listed — a model on a restricted provider is rejected when the app runs rather than being hidden from the picker.

The model you pick is pinned on the app, so saved apps keep building with the same model.

## Multi-File Source

An app is a real npm project, not a single text blob. Every text file in it is editable — the app's own code under `src/app/`, and also `package.json`, configuration, and framework files — and supporting files can hold components, helpers, data-shaping code, and database migrations. Binary files are read-only.

This lets the AppBuilder build more maintainable apps:

- UI code can be split into focused files
- The app's own `package.json` and lockfile decide which dependencies it uses
- You can browse and edit every text file on the [Code surface](#studio-surfaces), and download the complete npm project

An app's working tree is held on the server, which allows up to **2,000 files** per app.

## Studio surfaces

The AppBuilder is a single window with an assistant panel on the left and a workspace on the right. The workspace switches between six surfaces. **Preview** and **Settings** are tabs of their own; **Code**, **Terminal**, **Data** and **Analytics** share a **More** menu, which takes the name of the one you have open.

| Surface | Where | What it shows |
|---------|-------|---------------|
| **Preview** | Tab | The running app, live, at desktop / tablet / phone widths. **Reload preview** reloads it, **Full screen preview** opens it over the tab, and [**Draw annotation**](#mark-an-area-of-the-preview) scopes a change to one area. |
| **Settings** | Tab | Everything about the app that is not its code, in sections: **General** (how it appears in Apps), **Access** (ownership, sharing, and [who can open it](/insulin/custom-apps/publishing/#who-can-open-a-published-app)), **Domain** (the [addresses the published app answers on](/insulin/custom-apps/publishing/#the-apps-domain)), **AI model**, **Integrations** (the [connected services its code may use](/insulin/custom-apps/integrations/#connected-integrations)), **Secrets** (the owner's own [secrets](/insulin/custom-apps/publishing/#secrets-reach-the-app-when-you-publish)), **Database** (the [published app's data](/insulin/custom-apps/running/#data-an-app-keeps-for-itself)), and **Danger zone**. |
| **Code** | More menu | The project's file tree — filter it, open files in editor tabs, edit any text file (binary files are read-only), and **Download** the complete npm project. If you can edit the app, the tree also offers **New file** and **New folder**, and **Rename** and **Delete** when you hover an entry. |
| **Terminal** | More menu | The app server's own terminal — its install and dev-server output — plus any shell you open with **New shell**, which runs in the app's workspace. **Stop** interrupts the active one. |
| **Data** | More menu | The app's own database (SQLite): its tables, their rows, and a **Structure** view of each table's columns. |
| **Analytics** | More menu | Requests, errors and latency of the live app, and its database activity, over the last 24 hours, 7 days or 30 days. It has figures only once the app is published. |

The header shows whether a version is live (`vN live` — click it to open the app) or the app is still a **Draft**. Beside **App history** and **Publish** is **Save version**, which saves the app as its next version. It is unavailable while the builder is working on a request — yours, or one started elsewhere on the app — and comes back when that turn ends. A [visual review](#the-live-preview) runs against the surfaces the same way you read them: the rendered preview, its console, and its network activity.

Your edits reach the app's shared draft as you make them. If some have not arrived when you close the AppBuilder — with its back arrow, the window's close control, or **Close** in the Dock — it sends them first, and only if that fails does it ask **Discard unsynced edits?** (*Some of your latest edits haven't reached the app's draft. If you close now they'll be lost.*), with **Discard & close**.

## The Live Preview

The Preview surface runs the **real** app, not a static mock. The AppBuilder mounts the app's npm project in the browser, installs or restores its dependencies, and starts its dev server, so the preview is the working app with its own front end and its own backend — an HTTP server backed by an in-browser database.

While it starts, the preview shows each step — **Runtime**, **Prepare**, **Download**, **Unpack** and **Run** — and, once the app is compiling, the app server's latest output. The first launch downloads the app's packages; later launches reuse them.

Because the app runs a real project, an app that needs to remember what people enter gets a database of its own (see [Data an app keeps for itself](/insulin/custom-apps/running/#data-an-app-keeps-for-itself)); there is nothing to set up.

The app's [secrets](/insulin/custom-apps/publishing/#secrets-reach-the-app-when-you-publish) are injected into the preview as environment variables when the person previewing it is an organization **ADMIN** or **EDITOR** with **Editor** or higher on the app. Preview code and browser DevTools can read them, so sharing **Editor** access to an app shares its credentials. The same people's preview also gets an access token for the app itself, so its server code can call the Fours API — see [How a published app reaches your Fours data](/insulin/custom-apps/integrations/#how-a-published-app-reaches-your-fours-data) — and the app's [connected integrations](/insulin/custom-apps/integrations/#connected-integrations). For a personal app, that is its owner.

The preview can go full screen and copy to your clipboard, but it cannot use your location, camera or microphone: it runs code the assistant has just written. A [published](/insulin/custom-apps/publishing/) app can use all three once your browser allows it, and the browser remembers that permission for the Fours console rather than for one app — allowing it once allows it for every app you open there. An app can never read your clipboard or capture your screen.

The assistant can also run a **visual review**: it reads the rendered preview, screenshots, runtime logs and network activity to decide whether the output matches your request or needs another edit.

### Starting the builder conversation over

Your conversation with the builder is your own: each person who edits an app has a separate builder conversation for it, and nobody else sees what you asked. An app's earlier, shared builder conversation is not carried into anyone's.

If a session has gone in circles, send **`/clear`** in the builder's composer. It stops any reply still being written, deletes your builder conversation for this app and opens a fresh one. Other editors' conversations and the app's own code are untouched.

The builder works on one request per app at a time. If another editor — or you, in another tab — already has it working on the app, your message is refused with *The agent is already working on this app. Try again when it finishes.*

While the builder works on your own request, you can keep typing. What you send — and any quick reply or starter you click — waits in a tray above the composer and goes out when the turn ends, one message per turn. Your selected preview elements, the chosen model and your latest edits are read when each message actually goes out, not when you typed it. Each row has **Edit** and **Delete**, and **Steer** to send it into the running reply now, offered on the same terms as in [Chat](/insulin/agents/composer/#sending-while-a-reply-is-running): a text-only message, while the reply is running and not waiting for an approval, stopping, or syncing your edits. If a message can't go out — you pressed **Stop** before it started, or your edits could not sync — the tray shows **On hold** with **Resume**, and nothing more goes out until you press **Resume** or send again. The tray is kept in the page, so a reload drops it; `/clear` is never queued: it runs at once and empties the tray.

A very large request can stop part-way with *This task took more steps than allowed and stopped before it finished. Its changes so far are saved; send a smaller next step to continue.* The edits it made are kept, so ask for the rest as a smaller next step.
