docs / App mode
get started

App mode

Your app’s own page, <id>.fave1.app. The board, the list, the link someone sends a friend — the place people come back to.

ctx.surface === 'app'

Your address

Any address on https://<id>.fave1.app/ opens your app — one bundle, and the query and hash are yours to read. That’s how a link opens straight to the right thing: a note, a shared board, a page that says where a link goes. Put what a link needs in the query or hash, not the path: a link opened in a browser goes through My Fave1, which carries the query (up to 2,000 characters) and the hash but not the path, and paths that name your app’s files (/index.js, /manifest.json, /locales/…) serve those files.

src/index.ts
if (ctx.surface === 'app') {
  const q = new URL(location.href).searchParams;
  const shared = location.hash.startsWith('#s=') ? location.hash.slice(3) : null;
  if (shared) showShared(shared);        // a hash never reaches any server
  else if (q.get('u')) showLink(q.get('u')!);
  else showHome();
}

Fave1 uses ?review=, ?data=, ?locale=, ?dev=, ?app= and ?f1note= — pick any other names. #s= is the convention Fave1’s own apps use for a ctx.shared link: the ref after it is the whole key, and because it is a hash it never leaves the browser.

Trying it

Add your build as a DEV source in the launcher, then open My Fave1: it’s there first, with a DEV badge, and opens in app mode in the same window and phone card people get. With npm run dev, save a file and press the window’s refresh. On your phone or in Safari, add a Test link instead (App mode, too).

Like the DEV source, a test build starts in a sandbox — storage and pub stay in that browser. Switch Data to My account in the DEV panel to save to your account’s DEV slot instead, and see app mode the way people with an account will. A Test link from npm run submit or Versions also opens the build on its own, in any browser, for 12 hours (Test a build anywhere).

To see app mode in another language, add ?locale=ko (or es, pt-BR …) to a DEV or review build’s address — ctx.locale and ctx.t follow it. Live apps ignore it and use the person’s own language (ctx.locale · ctx.t).

The screen

WhereWhat you getSize
phoneThe whole screen under Fave1’s headerfull
Test linkOn a computer, a Test link opens on its own: a column in the middle of the browser window — phone-sized, or as wide as your manifest’s window asks for when the screen allows. Any other visit to your address opens your app in My Fave1390 · 760 · 1120
My Fave1A window people move and resize, next to other apps. It opens phone-size unless your manifest says "window": "medium" (760 wide) or "wide" (1120) — as wide as the screen allows390 · 760 · 1120

Drawing it

ctx.ui.host() is everything under the header — draw your screen there. The panel calls (corner, minimize, resizable, resize, hide) do nothing in app mode; there’s no page to get out of the way of. Fill the width you’re given, from a narrow window to a wide one.

Inside My Fave1

My Fave1 opens app mode in a frame. Almost everything works the way it does on its own page:

ThingInside My Fave1Works
popups · new tabswindow.open() and target="_blank" links open a new tabyes
downloads<a download> saves the fileyes
clipboardCopy on a tap. Paste with ctx.clipboard.read() — Fave1 asks firstyes
aictx.ai works the same — in app mode it asks once for your app, not per siteyes
leavingA plain link can’t take the whole window to another site — open it in a new tabnew tab
soundFave1 mutes your app while another one is in front, and turns it back up when yours is. Nothing to doauto
share sheetnavigator.share() opens the system share sheetyes
camera · micctx.camera and ctx.mic work when your manifest declares themyes
motion sensorsTilt and shake don’t reach the frame. Only a Test link opened on its own gets themno
pointer lock · screen capture · fullscreenThe frame doesn’t allow requestPointerLock(), getDisplayMedia() or requestFullscreen() — they fail. Use them on a site, or in a Test link opened on its ownno
localStorageYour own, but kept apart from the same address opened on its own (a Test link) — the browser files a frame’s storage separately. What should be the same everywhere goes in ctx.storageapart

When nobody is signed in

A link to <id>.fave1.app opened in a browser’s address bar goes to My Fave1 (www.fave1.com/myapps?open=<id>) — signed out, through sign-in first — and your app opens there, carrying the link’s ?query and #hash — as a visitor window if they haven’t added it yet, as long as it’s in the store. Inside My Fave1 your app runs in a frame at its own address; a review link (?review=) opens on its own page.

An app that declares only page permissions or clipboard opens straight away — and because it never asks the account, ctx.user.signedIn is false in app mode. One that declares anything else (storage, pub, ai, camera, mic) may show Safari and Firefox people a one-tap Continue first — Fave1 draws it; if their browser says no, your app opens for them signed out.

To sign someone in for app mode, link to https://www.fave1.com/myapps?open=<id>. Signed out, it goes through sign-in first; after that My Fave1 opens your app — added or not, as long as it’s in the store. On a site you don’t need a link: the panel header already has Join, and your app opens again once they’re in.

Sending people to app mode

From the page, open app mode in a new tab on a tap — See all your notes. Want them to land back on the exact spot later? Keep the page address with a text fragment (#:~:text=first%20words,last%20words), and leave yourself a note in ctx.storage so the page side knows what to light up when your app opens there again.

src/index.ts
ctx.ui.button('See them all', {
  onClick: () => window.open('https://my-app.fave1.app/', '_blank', 'noopener'),
});