Appy

Make a PWA Appy-ready

Instructions for a coding agent (or a person) working in the repository of a web app.

Appy is a macOS launcher that installs web apps as real Mac apps: their own Dock icon, window, cookies and notifications. Any site can be installed as it is. A site that declares itself gets more: its own commands in the Appy launcher, a chosen window size, a title bar in its colour, a menu bar item and global shortcuts.

Making an app Appy-ready is small: one JSON file, and optionally a few lines of JavaScript. Nothing to install, no SDK, no build step, and nothing changes for people who use the app in a browser.

What you will do

  1. Check the app already has the basics every installable web app needs.
  2. Add a declaration: /.well-known/appy.json, or an "appy" member in the existing web app manifest. Give the app a hidden title bar and its own header (strongly recommended): it is the difference between a website in a frame and a Mac app.
  3. Optionally use window.appy in the page for launcher commands, a menu bar item and global shortcuts.
  4. Send sign-in through the browser when the app runs inside Appy.
  5. Make it open like an app: the frame in the first response, skeletons instead of spinners, last state first.
  6. Add a "Download for Mac" button that links to Appy's install page for your app.
  7. Verify with the checks at the end.

Step 1: check the basics

Appy reads these from the web app manifest (<link rel="manifest">) and the page. Fix what is missing first.

NeededWhy
HTTPS, and everything on the app's own originAppy only reads declarations from the origin being installed.
name (or short_name)The name under the Dock icon. Falls back to the page <title>.
start_url and scopeWhere the app opens, and which addresses stay inside its window. Links out of scope open in the browser.
An icon of 512 × 512 px, PNG, with "purpose": "any" (the default)The Dock icon. Appy picks the icon closest to 512 px from above and prefers plain icons over maskable ones.
theme_colorThe colour of the title bar. Without it the bar follows <meta name="theme-color"> (which may differ for light and dark with media), then the page background.

Manifest shortcuts (each with name and url) become commands in the Appy launcher with no further work.

Step 2: declare the app

Choose one of the two forms. Use appy.json when you can add a static file; use the manifest member when the manifest is the only thing you can change.

Form A: /.well-known/appy.json

Serve this at https://<your-origin>/.well-known/appy.json with Content-Type: application/json. It uses the web manifest's member names and adds three of its own: capabilities, window and commands.

{
  "name": "Pomodoro",
  "start_url": "/",
  "scope": "/",
  "theme_color": "#D9480F",
  "icons": [{ "src": "/icon-512.png", "sizes": "512x512" }],

  "capabilities": ["notifications", "badge", "commands", "tray", "shortcut"],
  "window": { "width": 420, "height": 600, "titleBar": "hidden" },
  "commands": [
    { "id": "start", "title": "Start Focus Timer", "keywords": ["focus"] },
    { "id": "stats", "title": "Open Stats", "url": "/stats" }
  ]
}

Where the file goes in common setups:

StackPath in the repository
Next.js, Vite, Create React App, SvelteKit (static), Astro, Nuxtpublic/.well-known/appy.json (SvelteKit: static/.well-known/appy.json)
Rails, Laravel, Django with static filesthe public or static root, under .well-known/
Express and similarserve it from your static directory, or add a route that returns the JSON

Form B: an "appy" member in the manifest

{
  "name": "Pomodoro",
  "start_url": "/",
  "icons": [{ "src": "/icon-512.png", "sizes": "512x512" }],
  "appy": {
    "capabilities": ["notifications", "badge", "tray"],
    "window": { "width": 420, "height": 600 },
    "commands": [{ "id": "start", "title": "Start Focus Timer" }]
  }
}

When both forms exist, Appy merges them and appy.json wins.

Members

MemberMeaning
capabilitiesWhat the app asks for (list below). The person installing sees the list and can turn each one off, then or later.
window.width, window.heightFirst window size in points. Default 1200 × 800.
window.titleBar"hidden" (recommended): the page runs to the top of the window, under the window buttons, and draws its own header (see "A custom title bar"). "default" keeps a system title bar above the page.
window.trafficLightsWith a hidden title bar, where the window buttons go: { "x": 20, "y": 20 } is the gap in points from the window's top left corner to the first button. Optional (see "The safe area").
background_colorThe window's colour until the page has loaded; after that the window follows the page's own background (see "The window's colour").
commands[].id, commands[].titleA command shown in the Appy launcher. Both required.
commands[].urlThe command opens this in-scope address. Without it, the page receives the command (Step 3).
commands[].keywordsExtra words the launcher search should match.

A custom title bar

Use it. A hidden title bar is the recommended window for every Appy-ready app. A web page under a system title bar looks like a website in a frame; the same page running to the top of the window, with its own header beside the window buttons, looks like a Mac app. The default title bar is for sites that cannot change their layout. It takes three things, all below: a drag region, the safe area, and a page that is exactly the window's height.

With "window": { "titleBar": "hidden" } the page runs to the top of the window, under the three window buttons, and draws its own title bar. Say which parts move the window the way Electron apps do:

.titlebar {
  app-region: drag;          /* dragging here moves the window; a double-click zooms or minimizes it */
  --app-region: drag;        /* the same, for styles Appy cannot read as text (see below) */
  height: max(44px, var(--appy-titlebar-height, 0px));
  padding-left: var(--appy-window-controls-width, 0px);   /* room for the window buttons */
}
.titlebar .tabs { app-region: no-drag; --app-region: no-drag; }

The safe area

The window buttons sit over the page's top left corner. Appy tells the page how much room they take, as CSS variables on the root element, set before the page's own code runs:

VariableMeaningTypical
--appy-titlebar-heightHeight of the strip the window buttons sit in. They are centred in it.44px
--appy-window-controls-widthWidth to keep clear at the top left: the buttons and the gap after them.83px

Laying out under the window buttons

With a hidden title bar the page is the whole window, and it must be exactly the window's height. If the safe area is added on top of a full-height layout, the page becomes taller than the window, the whole document scrolls, and your header slides away under the window buttons.

html, body { height: 100%; margin: 0; overflow: hidden; }       /* the document itself never scrolls */

.app {
  height: 100vh;
  box-sizing: border-box;                                        /* the inset comes out of the height, not on top of it */
  padding-top: var(--appy-titlebar-height, 0px);
  display: flex;
}
.sidebar, .content { overflow-y: auto; min-height: 0; }          /* the panes scroll, inside the app */

The window's colour

Where the page has not painted yet (most visibly while the window is resized) the window shows through. Appy keeps it the colour of the page:

Capabilities

NameGives the app
notificationsThe standard Notification API, delivered as Mac notifications.
badgenavigator.setAppBadge() and navigator.clearAppBadge() on the Dock icon.
commandsIts commands in the Appy launcher.
trayA menu bar item with a title and a menu.
shortcutGlobal keyboard shortcuts.

Ask only for what the app uses: the list is shown to the person at install. A site with no declaration can still get notifications and badge, nothing else.

When the declaration changes

Appy reads the declaration at install and again every time the app opens. From the new one it takes theme_color, background_color, window, commands and capabilities:

theme_color is one fixed colour. For a title bar that follows the page (light and dark, per screen), use "titleBar": "hidden" and draw it yourself.

Step 3: use window.appy (optional)

Standard web APIs keep working as in a browser. The extras live on window.appy, which exists only inside Appy, so always feature-detect and never make the app depend on it.

if (window.appy) {
  appy.capabilities;                                   // what was granted, e.g. ["notifications", "tray"]

  // A launcher command declared without a "url" arrives here.
  appy.commands.on("start", () => startTimer());

  // Menu bar item. Needs the "tray" capability.
  await appy.tray.set({ title: "25:00", menu: [{ id: "stop", title: "Stop" }] });
  appy.tray.onSelect((id) => { if (id === "stop") stopTimer(); });

  // Global shortcut. Needs the "shortcut" capability, and Cmd, Ctrl or Option in the combination.
  await appy.shortcut.register("Ctrl+Option+P", () => toggleTimer());
}

Check appy.capabilities before using tray or shortcut: the person may have turned one off.

Step 4: sign in through the browser

Inside Appy your app runs in a system web view, not in a browser. Sign-in is the one thing that is reliably better in a real browser:

So when window.appy is present, send sign-in to the browser and take the result back with appy.auth.start(). Do this for every sign-in that leaves your own form: Google and other providers, single sign-on, passkeys.

// In the page. In a browser this branch is skipped and sign-in runs as it always has.
if (window.appy && appy.auth) {
  document.querySelector("#sign-in").addEventListener("click", (e) => {
    e.preventDefault();
    appy.auth.start("/login");   // opens https://YOUR-ORIGIN/login?appy_return=appy-…://open in the browser
  });
}

Appy opens that page of your own site in the default browser and adds one query parameter, appy_return. On the server:

  1. On /login, remember appy_return for this sign-in (in the session or the OAuth state). Accept it only if it matches ^appy-[0-9a-fA-F-]{36}://open$.
  2. Sign the person in as usual, passkey included: this is the browser.
  3. Create a one-time code: random, single use, valid for about a minute, tied to the account.
  4. Redirect the browser to <appy_return>?url=<encoded https://YOUR-ORIGIN/auth/finish?code=THE-CODE>. The browser asks to open the app.
  5. Appy loads that address in the app's window. /auth/finish checks the code, sets the session cookie and redirects into the app.
// Step 4, on the server (Express-style):
const finish = new URL("/auth/finish", "https://YOUR-ORIGIN");
finish.searchParams.set("code", oneTimeCode);
res.redirect(appyReturn + "?url=" + encodeURIComponent(finish.href));

When sign-in lives on another site

Many apps sign in at a shared account service on its own origin (app.example.com sends people to id.example.com). Inside Appy the app's window is then showing the account service's page, outside the app's scope, when the person presses "Sign in". That page may call appy.auth.start() too, with two rules:

The account service does the work once, for every app that signs in through it:

  1. Its sign-in page checks window.appy && appy.auth and, instead of signing in there, calls appy.auth.start() with an address that carries the pending request (for example /authorize?req=…, not just /), so the browser can finish the same sign-in.
  2. In the browser, after signing the person in, it does not redirect the browser to the app. It redirects to <appy_return>?url=<encoded address>, where the address is either the app's own callback with the authorization code (in the app's scope: the app's window finishes exactly as it would in a browser), or a page on the account service that turns a one-time code into its session and then continues the pending request.

Do not send the person back to the account service's home page: the app's window would be left on the account service with no way on to the app.

What still works inside the app if you change nothing: passwords typed into your own form, email links and codes, redirects through another site and back, and popups opened with window.open (a popup is a window of the app, shares its session and can postMessage to window.opener). Treat these as a fallback: any of them stops working the moment the provider wants a passkey.

Rules that keep this safe:

Appy has no tabs. A link to an address inside the app's scope opens in the app's own window, target="_blank" included, as does a window.open from a click; only links out of scope go to the browser. So a link to the app's own PDF, image or text file replaces the app with that file, filling the window.

const fileLink = (url, name) => window.appy
  ? { href: url, download: name }                         // Appy: to Downloads
  : { href: url, target: "_blank", rel: "noopener" };    // browser: a new tab

An image viewer

An image in a chat or a gallery is better looked at than downloaded. Inside Appy, open it over the page in a viewer of your own instead of following its link:

link.addEventListener("click", (event) => {
  if (!window.appy) return;              // a browser follows the link
  event.preventDefault();
  viewerImage.src = link.href;
  viewer.showModal();                    // <dialog id="viewer"> with the image, a close button and Download
});

Open like an app: first paint and skeletons

A Mac app shows its window, already laid out, the moment it is opened. An installed web app can do the same, and the gap between "window appears" and "app is there" is most of what makes one feel like a website. Appy does its part: the window opens at once, at the declared size, filled with background_color. The rest is the page's.

1. Send the frame in the first response. The HTML that comes back for start_url should already contain the app's frame: header, sidebar, main area, with their real sizes and colours, styled by CSS inlined in <head>. It must not need JavaScript, data or a web font to draw.

<html style="background:#141413">                        <!-- the same colour as background_color -->
<head>
  <style>/* frame only: layout, colours, the title bar and its safe area. A few kB. */</style>
  <script>document.documentElement.dataset.theme = localStorage.theme || "dark"</script>   <!-- before first paint -->
  <script type="module" src="/app.js"></script>           <!-- the app itself loads after -->
</head>
<body>
  <div class="app">
    <header class="titlebar">…</header>                   <!-- drag region and safe area work before any script runs -->
    <nav class="sidebar"><div class="skeleton row"></div>…</nav>
    <main class="content"><div class="skeleton block"></div></main>
  </div>
</body>

2. Use skeletons, not spinners.

3. Show what you had last time. A reopened app should look the way it was left.

4. Do not make the start a chain.

5. Get the first frame's colours right.

6. Keep it stable. Reserve space for everything that arrives late (images with width and height, lists with a known row height). Nothing on screen should jump after it has been drawn.

Check it: quit the app and open it again, three times. There is never a white (or wrong-theme) frame, the title bar and navigation are there from the first frame, the window can be dragged at once, and nothing shifts as content arrives. Then try it once with the network throttled.

Offer the Mac app to your users

Once the app is Appy-ready, give people a "Download for Mac" button. It is one link:

<a href="https://appy.sh/get/?url=https%3A%2F%2Fapp.example.com%2F&name=Example">Download for Mac</a>

Where and how to show it:

const inAppy = "appy" in window;
const onMac = /Macintosh|Mac OS X/.test(navigator.userAgent) && navigator.maxTouchPoints < 2;   // iPads say Macintosh too
downloadButton.hidden = inAppy || !onMac;

Check it: open your link in a browser on a Mac with Appy installed and press "Open in Appy" (the browser may ask once whether to allow it): Appy shows your app's name and icon and offers to install it. Then open the link in a private window to see the page a newcomer gets.

Install links need a version of Appy that knows them; the page tells people with an older one to update, and shows the address to paste into Appy instead.

Step 5: verify

Run these against the deployed site (or a local HTTPS preview) and fix anything that fails.

# 1. The declaration is JSON, not your app's HTML. A single-page app's catch-all route often answers every path
#    with index.html and status 200: exclude /.well-known/ from it.
curl -sS -i https://YOUR-ORIGIN/.well-known/appy.json | head -20

# 2. It parses, and every command has an id and a title.
curl -sS https://YOUR-ORIGIN/.well-known/appy.json | python3 -m json.tool

# 3. The icon exists and is a PNG of at least 512 px.
curl -sS -I https://YOUR-ORIGIN/icon-512.png

Validate against the JSON Schema at https://appy.sh/appy.schema.json if you have a validator at hand.

If Appy is installed on the machine, install the app for real and look at it:

/Applications/Appy.app/Contents/MacOS/Appy install https://YOUR-ORIGIN/

Checklist before you finish:

Do not

Packaged apps (no server)

An app can also ship as a single file. A .appyapp is a zip of a folder holding app.json (the same schema, plus an id such as "com.example.timer" and a relative start_url) next to the app's files. Appy serves them offline. Install with a double-click, or Appy install timer.appyapp.