A companion app is a Swell app that comes with a theme. The theme names the app in its swell.json, merchants install the app with the theme, and the app has no listing of its own in the Swell App Store. A companion app is always free.

A companion app is an ordinary app with one extra flag, and any theme can name one. It reaches the theme through the same storefront extensions any app can declare: data sources the theme renders, actions the theme's forms post to, and embed blocks. Only Wave reads data sources and actions today. See Storefront extensions for the full reference.

A theme renders store data and nothing more. Features beyond display belong in an app: anything that stores records, runs logic on a server, calls an outside service or checks who a customer is. Examples are gift registries, quote requests, bookings and wholesale ordering.

Make the app a companion when it exists for your theme: its value is the sections the theme builds around it, and merchants wouldn't install it on its own. If the app is useful with any theme, list it in the Swell App Store instead, and have your theme name it as a required or optional app.

Add "companion": true at the top level of the app's swell.json:

swell.json
{
  "id": "gift_registry",
  "name": "Gift Registry",
  "type": "admin",
  "version": "1.0.0",
  "description": "Customers create gift registries from their account",
  "companion": true
}

companion is a boolean. Any other value is refused. The flag names no theme, so several themes can share one companion app. Any app type can be a companion. Swell copies the flag to the app when you push.

The theme names its companion apps, and any other apps it needs, in theme.apps in its own swell.json:

swell.json
{
  "id": "my_theme",
  "type": "theme",
  "theme": {
    "storefront": { "app": "wave" },
    "apps": [
      {
        "id": "gift_registry",
        "required": true,
        "min_version": "1.0.0",
        "why": "Lets customers create and share gift registries"
      }
    ]
  }
}
KeyDescription
idThe app's id, the id in its swell.json: 1 to 40 characters of a-z, 0-9, _ and -. It names one of your own apps, published or not, or any published app.
requiredOptional boolean. Defaults to false. A companion app installs with the theme either way. A required app that isn't a companion is shown in the theme's install dialog as sold separately, and a missing required app gets warnings in the dashboard and in Wave's Publish.
min_versionOptional. The lowest version of the app the theme works with, as x.y.z with digits only, such as 1.0.0. When the theme is installed or updated, Swell updates a companion app installed at a lower version.
whyOptional. What the app does for the theme, 1 to 200 characters. Merchants see it next to the app.

theme.apps follows these rules:

  • A theme can name at most 10 apps.
  • Each entry has only the keys id, required, min_version and why. Any other key is refused.
  • Each app is named once.
  • Every id must name an existing app when the theme is pushed: one of your own apps, or a published app.

swell app push checks the same rules before it sends the theme.

Push the companion app before the theme that names it. A theme whose theme.apps names an app Swell can't find is refused with:

theme.apps 'gift_registry' doesn't name an app: use the id of one of your own apps or of a published app (push the app first).

The check runs only when the theme's theme object is written, so a theme can still be updated in other ways after an app it names is removed. When a new theme version needs a new companion version, release the companion first.

A companion app uses the storefront extensions every app can declare under storefront in its swell.json. They work on Wave storefronts. Proxima doesn't support them, so a Proxima theme can name a companion app but can't use its blocks, data sources or actions.

  • Data sources (storefront.data): the theme reads the app's data while Wave renders the page, through a section field of type app_data that names the app and the source. The section gets {status, value}, where status is ok, signed_out, missing_app or error.
  • Actions (storefront.actions): the theme posts a form to one of the app's functions with ui-kit's AppAction. The function answers with effects that Wave applies: cart lines, a message, a redirect or a reload, or errors per field.
  • Embeds (storefront.embeds): blocks that run the app's own UI in the page, which merchants place in the editor.

Data and action functions are public routes. Treat every call as public: only the shopper's session says who is signed in, and the function checks that the records it returns or changes belong to that account.

A companion app adds no theme settings. Who can see pages or prices is the theme's own setting (see Settings that read the shopper in Wave), and it changes only what Wave renders. Swell's Storefront API, public function routes and checkout stay open whatever the theme does, so an app whose features are only for some customers, such as approved business buyers, checks the account on its own server: in its functions and in its order hooks.

→ See Storefront extensions for every key, limit and check.

This companion app stores gift registries in its own registries model. It declares one data source, the signed-in customer's registries, and one action, which creates a registry.

swell.json (the app)
{
  "id": "gift_registry",
  "name": "Gift Registry",
  "type": "admin",
  "version": "1.0.0",
  "description": "Customers create gift registries from their account",
  "companion": true,
  "storefront": {
    "data": [
      {
        "id": "registries",
        "label": "Your registries",
        "scope": "account",
        "from": {
          "collection": "registries",
          "where": {
            "account_id": "$account.id"
          },
          "fields": [
            "name",
            "event_date"
          ],
          "sort": "event_date asc",
          "limit": 10
        },
        "sample": [
          {
            "name": "Our wedding",
            "event_date": "2027-06-12"
          }
        ]
      }
    ],
    "actions": [
      {
        "id": "create_registry",
        "label": "Create a registry",
        "function": "storefront-create-registry",
        "requires": "account",
        "fields": [
          {
            "id": "name",
            "type": "text",
            "max": 80,
            "required": true
          },
          {
            "id": "event_date",
            "type": "text",
            "max": 10
          }
        ],
        "effects": [
          "message",
          "reload"
        ]
      }
    ]
  }
}

The action's function:

functions/storefront-create-registry.ts
export const config: SwellConfig = {
  description: 'Storefront action: create a gift registry',
  route: { methods: ['post'], public: true },
};

export async function post(req: SwellRequest) {
  // Who is signed in comes from the session, never from the body
  const accountId = (req.session as { account_id?: string } | undefined)?.account_id;
  if (!accountId) return { errors: { _form: 'Sign in to create a registry.' } };

  const input = (req.body?.input ?? {}) as { name?: unknown; event_date?: unknown };
  const name = typeof input.name === 'string' ? input.name.trim().slice(0, 80) : '';
  if (!name) return { errors: { name: 'Enter a name for the registry.' } };
  const date = typeof input.event_date === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(input.event_date) ? input.event_date : null;

  await req.swell.post('/apps/gift_registry/registries', { account_id: accountId, name, event_date: date });
  return { message: { text: 'Registry created.', tone: 'success' }, reload: true };
}

The theme names the app in theme.apps, as in Declare a companion app above, and a section reads the data source and posts the form:

theme/sections/gift_registries.tsx
import { AppAction, Container } from 'ui-kit';
import type { SiteInfo } from 'ui-kit';

export const schema = {
  label: 'Gift registries',
  fields: [
    { id: 'heading', type: 'text', label: 'Heading', default: 'Your registries' },
    { id: 'name_label', type: 'text', label: 'Name label', default: 'Registry name' },
    { id: 'button_label', type: 'text', label: 'Button label', default: 'Create registry' },
    { id: 'registries', type: 'app_data', label: 'Registries', app: 'gift_registry', source: 'registries' },
  ],
} as const;

type Registry = { name: string; event_date?: string };
type Props = {
  site?: SiteInfo; heading?: string; name_label?: string; button_label?: string;
  registries?: { status: string; value: unknown };
};

export default function GiftRegistries({ site, heading, name_label, button_label, registries }: Props) {
  // Without the app (missing_app), or for a guest or a failed read, the section shows nothing
  if (registries?.status !== 'ok') return null;
  const list = Array.isArray(registries.value) ? (registries.value as Registry[]) : [];
  const raw = site?.app_flash;
  const flash = raw?.app === 'gift_registry' && raw.action === 'create_registry' ? raw : null;
  return (
    <section>
      <Container>
        {heading ? <h2>{heading}</h2> : null}
        {list.length ? <ul>{list.map((r, i) => <li key={i}>{r.name}</li>)}</ul> : null}
        <AppAction app="gift_registry" action="create_registry" returnTo={site?.page.path} flash={flash}>
          {({ values, errors }) => (
            <>
              <label>{name_label}<input name="name" defaultValue={values.name} /></label>
              {errors.name ? <p role="alert">{errors.name}</p> : null}
              <button type="submit">{button_label}</button>
            </>
          )}
        </AppAction>
      </Container>
    </section>
  );
}

When the app isn't installed, the registries field's status is missing_app and the section renders nothing, so the page has no form that can't be sent.

In the Swell dashboard, the theme's page lists the apps it names in theme.apps, each with its icon, name, description, version, whether it's required or optional, the theme's why, and whether the store has it. An app the store doesn't have shows an Install button, and an installed one a Settings link.

When a merchant installs the theme or creates a storefront from it, Swell installs every companion app the theme names that the store doesn't have, required or optional, with no price or billing step. The theme's install dialog lists each one with the theme's why and the app's permissions, and the merchant can't leave one out. A companion app that fails to install never blocks the theme or the storefront: the dashboard and Wave show it as missing. A required app that isn't a companion, such as a paid app from the Swell App Store, doesn't install with the theme: the dialog lists it as sold separately, with its price, and the merchant installs it on its own. Optional apps that aren't companions are shown on the theme's page but not installed.

The theme's app list, its install dialog and the missing-app warnings are in the new Swell dashboard. Swell installs companion apps with their theme from the classic dashboard too, and the classic dashboard hides them from its installed Apps list.

Wave never installs apps. A theme pushed to a storefront without its companion app renders, and the editor and the dashboard show what's missing.

A companion app can be missing because the merchant skipped it, disabled it or uninstalled it. Apps are installed per store, so one installation serves every storefront in the store.

  • Dashboard: the storefront's theme card warns that the theme needs the app and offers Install. Each app shows its state: not installed, disabled, installed, or installed at a version below min_version.
  • Wave editor: a section with an app_data field whose app is missing shows a note in the canvas. Publish warns about each section that reads a missing app's data or posts a form to it, and about each required app the theme names that isn't installed, with a link to install it.
  • Shoppers: an app_data field gets status: missing_app and value: null, and the section renders its own empty state. An AppAction form still renders, and when a shopper sends it, Wave returns them to the page without calling anything.

A theme must render without broken sections when its companion app is missing. Give every section that reads an app's data an empty state for anything but ok, and render a form only when a data source from the same app answers, as in the example.

A companion app's settings are ordinary app settings, declared in its settings/ files (see Settings), and its admin views work as for any app. Companion apps aren't in the installed Apps list, so merchants open an installed one from the Settings link on the theme's page or the storefront's theme card.

The theme's settings are separate: merchants change them in Wave's Theme tab. Keep each setting where it is enforced. What Wave renders, such as which pages or prices a shopper sees, is a theme setting. What the app checks on its server, such as who may request a quote or place an order, is an app setting.

A companion app has its own versions and releases, and merchants update it like any other app, from the app's page. When a merchant installs or updates the theme, Swell also installs the companion apps that theme version names, and updates one installed below the version's min_version to the companion's published version.

min_version applies only when the theme is installed or updated. Installing or updating the companion app on its own doesn't check it, and a companion app installed for development is never updated. When the installed version is lower, the dashboard says which version the theme needs. Keep each companion version compatible with the theme versions merchants already have, and add data sources and actions rather than renaming or removing them: a section whose source or action is gone renders its empty state.

Merchants uninstall a companion app from its page, like any other app. The dashboard doesn't warn that a theme uses it. Afterwards, the storefront's theme card shows the missing-app warning, and the theme's sections that use the app render their empty states. Swell installs it again the next time the theme is installed or updated, or a storefront is created from it. A companion app the merchant disabled stays disabled.

A companion app is always free and can't carry a price. Swell refuses a price, a billing interval, a free trial or external pricing on a companion app, both when the app is saved and when a version is released, and a companion app can't run a sale. Merchants see no price or billing step when they install it.

The theme can be paid. Its one-time price covers the companion apps that come with it. See Selling themes.

A companion app has no listing of its own. It is left out of the Swell App Store's lists, search and category counts, and out of the installed Apps list in the dashboard.

It is still reachable by its id. In the dashboard, a link to a companion app the store hasn't installed opens a page that lists the published themes it comes with, each opening that theme's page. Swell's public apps API returns only a companion app's id, name, description, icon, version and themes.

Merchants see a companion app with the themes that name it: on the theme's page in the dashboard, and on the theme's page in the Theme Store, which shows the published apps a theme names with the theme's why. The Theme Store resolves apps by their published id, so a theme that names an unpublished app shows nothing for it there. Because a companion app appears only on its themes' pages, its name, description and icon matter, but it needs no listing copy in DESCRIPTION.md.

Theme Store review checks these rules for a theme and its companion apps:

  • The theme names each companion app, and any other app it requires, in theme.apps, and the companion app's swell.json has "companion": true.
  • The companion app is free. The theme may be paid or free.
  • The companion app has no listing of its own.

Test the theme on a store without its companion apps as well as with them: every page should render, with empty states in place of the app's data. Describe the companion apps, and what each one does for the theme, in the theme's documentation.

A partner theme can come with a companion app the partner makes. The theme can name it by its id before it's published. Merchants can install it, and the Theme Store can show it, only once it's published, so release and publish the companion app as for any app before the theme is listed. See App distribution and App Store submission.

A theme can also name a published companion app made by another developer, by its public id. Merchants get it with your theme the same way, and it stays free. Its developer controls its versions, so check your theme against its new releases.

A companion app can't also be listed in the Swell App Store. To list it, remove companion from its swell.json. Themes can still name it in theme.apps, as a required or optional app, and it can then carry a price.

  • Listing or warning about a theme's apps in the classic dashboard.
  • A warning before a merchant uninstalls a companion app that a theme uses.
  • Checking min_version when a companion app is installed or updated on its own, or for apps that aren't companions.