# Ship your first app in 5 minutes

Scaffold, run it on a real site with a DEV badge, upload. The CLI ships the build — the console starts review.

- **Fave1 in your bookmarks bar.** You test on real sites through the launcher — [add it here](https://www.fave1.com/get-started), on a computer.
- **A developer account.** Sign in on this site and press **Become a developer**. It’s the same Fave1 account, and it gives you a team for your apps.
- **Node.js 20 or newer**, and Chrome or Edge while you build — Safari blocks `http://localhost` on https sites.
- **Started in Studio?** Download it there — the .zip is a ready project, so skip step 1 and run `npm install`, then `npm install -D @fave1/cli@latest` to be on the latest. Every upload shows up in Studio either way ([Studio and the CLI](https://developers.fave1.com/docs/studio.md#cli)).

## Five steps

1. **Scaffold · `npm create @fave1/app my-app`** — Pick one of four templates. The name becomes your app ID (`my-app`) — lowercase letters, digits and hyphens. It’s fixed once you create the app in the console — the store address is built from it — so pick it with care. You get `manifest.json`, `src/index.ts` and `locales/en.json` — the code, and the words it says through [ctx.t](https://developers.fave1.com/docs/ctx-locale.md), so other languages can come later. That’s the whole app. Skip the questions with flags after `--`: `npm create @fave1/app my-app -- --template panel --name "My App"`. Made the app in the console first? Its Overview shows this command with your ID filled in.
2. **Run it · `npm install` then `npm run dev`** — Open any shop or article and click Fave1 in your bookmarks bar. Press and hold the Fave1 logo at the top left of the panel for a second — a DEV panel opens. Paste `http://localhost:7300` and Add. Your app shows up first in the grid with a DEV badge. Chrome asks once per site to allow local network access — allow it; the panel waits for it. Save a file, close the app and open it again — it reloads. Changed `manifest.json`? Close Fave1 and click it in your bookmarks bar again — reopening the app isn’t enough. Building another app at the same time? Run its `npm run dev` too — it takes the next free port (`7301`) — and add that address as well: both show up ([DEV sources](#dev-source)). Its app mode shows up in My Fave1 too ([App mode, too](#home)). Saves stay in a sandbox in this browser — to run it on your real account, press **My account** under Data in the same panel ([My account](#dev-account)).
3. **Create it · in the [console](https://developers.fave1.com/apps)** — Open the link step 1 printed — **Create app** opens with your ID already filled in. The ID has to match `id` in your `manifest.json`; uploads for an ID your team doesn’t own are refused. App IDs are unique across Fave1, so if yours is taken, change `id` (and `name` in `package.json`) and use the new one.
4. **Get a key · [API keys](https://developers.fave1.com/keys?create=1)** — Create a key with the **publish** scope — it’s shown once. Paste it into a `.env` file in your project as `FAVE1_KEY=f1_live_…`; new projects already keep `.env` out of git. In CI, set `FAVE1_KEY` as a secret — the environment wins over `.env`.
5. **Upload · `npm run submit`** — It builds and uploads. The build lands in Versions as Ready — nothing is public yet — and the CLI prints a [Test](https://developers.fave1.com/docs/publishing.md#test) link: that build in app mode, in any browser, Safari too, for 12 hours. Fill in your store listing, run the pre-check on the build, then press **Submit for review** — one button sends the build and the listing together ([Publishing](https://developers.fave1.com/docs/publishing.md)).

```bash
$ npm create @fave1/app my-app
$ cd my-app
$ npm install
$ npm run dev
  ✓ my-app · dev server on http://localhost:7300
    In the launcher on any site: hold the Fave1 logo, paste
      http://localhost:7300
    and Add — your app shows up first, with a DEV badge.
    App mode (ctx.surface 'app'): once added, it shows up first in My Fave1 too — https://www.fave1.com/myapps
```

```bash
# .env
FAVE1_KEY=f1_live_…   ← the key from API keys
$ npm run submit
  ✓ Uploaded v1.0.0
    Try it: https://my-app.fave1.app/?review=…
            Your app in app mode, in any browser — Safari too — for 12 hours.
    It is sitting in Versions as Ready. Nothing is public yet.
```

## Hello World

`src/index.ts`

```ts
Fave1.defineApp({
  onLaunch(ctx) {
    ctx.ui.render([
      ctx.ui.heading('Hello'),
      ctx.ui.text(`You're on: ${ctx.page.title}`),
    ]);
  },
});
```

The title needs no permission. Reading page text or the live DOM does — declare it in `manifest.json`, and people can turn it off in Settings.

> `Fave1` is a global the runtime provides while your bundle runs — call `Fave1.defineApp` once, at the top, and everything after that comes in `ctx`. Nothing to install or import for it. The types come from `types/fave1.d.ts` — `npx fave1 types` updates that file when a new `ctx` API comes out. Everything else is normal: split your code across files, `import` npm packages — `npm run build` type-checks and bundles it all into the one script the shell loads (esbuild, under 1 MB).

> One file of code is all that ships — `dist/index.js`, plus your `locales/*.json` language files if you have them ([ctx.locale · ctx.t](https://developers.fave1.com/docs/ctx-locale.md)); the store icon comes from the console. Import what you draw with and the build puts it inside: `import css from './panel.css'` and `.svg` files come in as text, `.png`, `.jpg`, `.gif` and `.webp` as `data:` URLs. Sounds come from Web Audio, and text uses the system font. There is nowhere to put a second script — `npm run submit` warns about anything else left in `dist/`.

> **Styling on strict sites.** Many shops and news sites forbid inline styles in their security policy, so a `<style>` element you add is silently ignored there. Use what the policy can’t block: `const sheet = new CSSStyleSheet(); sheet.replaceSync(css); root.adoptedStyleSheets = [sheet];` on your shadow root, or `el.style.cssText = '…'` for one element. Fave1’s own panel works the same way.

## DEV sources

Signed in with your developer account, your DEV sources are one list for the whole account: add one on any site and it shows up in the launcher on every site and in [My Fave1](https://www.fave1.com/myapps); take it out anywhere and it’s gone everywhere, the next time you open Fave1. Signed out, an address stays on the site where you added it. An address is `http://localhost:<port>` or a [Test link](https://developers.fave1.com/docs/publishing.md#test). Building more than one app? Add up to 8, one per app — each from its own `npm run dev`, which takes the next free port (`7300`, `7301`, `7302`…). They come first in the grid, in the order you added them, and they count toward the grid’s slots — 12, or 16 on Plus and 20 on Ultra — so with two DEV apps on 12 you see those two and the first ten of your own. If you already have the live app with the same ID, both are there — your DEV build with the badge, the live one in its usual place — and each opens on its own, with its own data. A DEV app whose address isn’t answering — `npm run dev` stopped, or a Test link ran out — stays in the grid, dimmed, and the live app stays where it was; click the dimmed one to try again. The panel lists them with what each one is doing: **×** takes one out, **Clear all** takes them all out — everywhere.

**A version that’s live isn’t a DEV build anymore.** When your app’s version passes review, the DEV build with that version number leaves the launcher and My Fave1 by itself, and Fave1 tells you why. To keep building, raise `version` in `manifest.json` above the live one and add the address again — it’s a DEV build again, next to the live app. This applies to your own team’s apps. Two addresses serving the same app ID? The first one shows, and the panel says so. Open `http://localhost:7300` in a tab to see what `fave1 dev` is serving — the address to paste, and anything wrong with your `manifest.json`.

The launcher reads your `manifest.json` once, when it opens — so after you change the name, icon or permissions, close Fave1 and click the bookmarklet again. Code changes only need the app closed and opened again. The same goes for a new file in `locales/`; editing one that’s already there only needs the app reopened.

**Another language.** `fave1 dev` serves your `locales/` folder and lists the languages it found when it starts. In the DEV panel, type a language under **Set language** — `ko`, `pt-BR` — and your DEV apps open in it; **Use mine** goes back to yours. It changes nothing for real people ([ctx.locale](https://developers.fave1.com/docs/ctx-locale.md#dev)).

A DEV build starts in a sandbox. [ctx.storage](https://developers.fave1.com/docs/ctx-storage.md#dev), [ctx.files](https://developers.fave1.com/docs/ctx-files.md#dev), [ctx.shared](https://developers.fave1.com/docs/ctx-shared.md#dev), [ctx.pub](https://developers.fave1.com/docs/ctx-pub.md#dev), [ctx.live](https://developers.fave1.com/docs/ctx-live.md#dev) and [ctx.notify](https://developers.fave1.com/docs/ctx-notify.md#dev) keep everything in this browser and never touch a real account — and [ctx.ai](https://developers.fave1.com/docs/ctx-ai.md) answers from two mock AIs, so it costs nothing — and because of that, `ctx.can('storage')` and `ctx.can('pub')` are `true` even when you’re signed out. To try sign-in, the first-time prompt or another site, switch to [your account](#dev-account).

> Added, but no DEV app? Its line in the panel says what went wrong. **Couldn’t reach localhost** means `fave1 dev` isn’t answering — check that `npm run dev` is still running, and that you didn’t dismiss Chrome’s local network prompt (allow it in the site settings next to the address bar, then reload). If it names a file or a `manifest.json` field, fix that and add it again. When the app itself won’t open, the panel shows why — `dist/index.js not found` means the build hasn’t run, and an error your code threw shows with its message. In Safari it can’t work: Safari blocks `http://localhost` on https sites, and says so in the panel — build in Chrome or Edge, and check Safari with [Test](https://developers.fave1.com/docs/publishing.md#test).

## My account — test on your real account

Under the DEV sources in the same panel, **Data** picks where your builds save — two buttons, **Sandbox** and **My account**. **Sandbox** (the default) keeps it in this browser. **My account** sends `ctx.storage`, `ctx.files`, `ctx.shared`, `ctx.pub` and `ctx.live` to your own Fave1 account — the way it will run live. Press it, then open your app again. It’s the step to take before you upload: the first-use prompt, sign-out and your data on another site only show up here.

- **Kept apart.** Your build writes to a DEV slot, `<id>@dev`, not to the live app’s data — your own or anyone else’s. It shows up in Fave1 settings › Storage as **\<App> · DEV**, where you clear it.
- **Everything people will see.** The “Use your Fave1 account here?” prompt on a new site, “Not now”, the same data on another site or device, `ctx.user.id`, your teammates’ rows in `ctx.pub`, a real `ctx.live` room between two browsers, a `ctx.shared` link that opens somewhere else.
- **Signed out too.** Sign out of Fave1 and `ctx.can('storage')` turns `false`, like it will for a visitor.
- **AI is real, with a cap.** `ctx.ai` answers for real on your own Fave1 credits, up to a $2 limit on the DEV slot. Without credits it still answers mock.

> A step-by-step, what to try, and what each way of running shows: [Testing](https://developers.fave1.com/docs/testing.md).

It’s for your team only. If you aren’t on the app’s team in the console, the build stays in the sandbox and says so. Permissions come from the build’s `manifest.json`, so the DEV slot never asks for more than you declared.

## App mode, too

The DEV source runs your app on a site. Your app also has an app mode — [its own page](https://developers.fave1.com/docs/app-mode.md), where `ctx.surface` is `'app'` — and people open it from [My Fave1](https://www.fave1.com/myapps), in a window on a laptop and a card on a phone. Test it there, in the same window: every app you added as a DEV source shows up in My Fave1 too.

1. **Sign in with your developer account** — Use the account you use on this site, both in the launcher and on `www.fave1.com`. Fave1 only remembers a DEV source for an account in the developer program, and only while you’re signed in.
2. **Add your DEV sources · in the launcher** — On any site, open Fave1, hold the logo and Add `http://localhost:7300` — or a [Test link](https://developers.fave1.com/docs/publishing.md#test). As soon as an app loads there, Fave1 keeps it for your account — each one you add, up to 8 — and it shows up in the launcher on every other site too.
3. **Open My Fave1 · `www.fave1.com/myapps`** — Your DEV apps are the first apps in the grid, each with a yellow **DEV** badge and the same icon as in the launcher — the same apps, in the same order, that the launcher shows on a site. Hover one to see its port (`:7300`) or the build number of the Test link. One whose address isn’t answering — `npm run dev` stopped, or the Test link ran out — is dimmed here just like in the launcher; tap it to try again. Already had My Fave1 open? Reload it.
4. **Open it** — Tap it. On a laptop it opens as a window, on a phone as a full-screen card — exactly how people will open your app. The window opens phone-size unless your manifest asks for `"window": "medium"` or `"wide"` ([window](https://developers.fave1.com/docs/manifest.md#fields)). The window says **DEV · Local** or **DEV** next to the name, and the line at the top says where the build came from and where it saves. The first time, Chrome asks to allow local network access for www.fave1.com — allow it. Have the live version installed? Open it next to your build and compare.
5. **Change something · then refresh the window** — Save a file, and press the refresh button at the top of the window — it loads your newest build. That includes `manifest.json`: unlike the launcher, the window reads it again each time. Resize the window, minimise it to the dock, switch apps on your phone — whatever people will do.
6. **Done · take it out** — In the DEV panel, **×** on its line takes it out of My Fave1 and out of the launcher on every site and device; **Clear all** takes them all. Or in My Fave1, tap **Edit** and the **−** on the DEV app — the same thing, with no question asked, because nothing your build saved is deleted. While you’re editing you can also drag DEV apps into a different order; they stay ahead of your other apps, and the launcher follows. The list holds up to 8 — remove one to add another.

- **On your phone and in Safari.** They can’t reach `localhost`. Upload with `npm run submit`, add the Test link it prints as a DEV source on your laptop, then open My Fave1 on your phone. Test links last 12 hours.
- **Data works like the DEV panel.** **Sandbox** keeps saves in that browser, in app mode. **My account** uses [your DEV slot](#dev-account) — the same data on every device and site.

> **No DEV app in My Fave1?** Check that you’re signed in with the same developer account in the launcher and on www.fave1.com, then reload My Fave1. If the launcher can’t reach Fave1 on that page — a few sites block it — add it on another site. **“This browser can’t reach localhost”** means you’re on a phone or in Safari: add a Test link instead. **“That Test link has expired”**: make a new one in Versions and add it again. **Can’t reach localhost:7300** inside the window means `npm run dev` stopped, or Chrome’s network prompt was dismissed — start it again or allow it next to the address bar, then refresh. **A different app is running** means that port now serves another project — add that one’s address in the DEV panel.
