---
title: Publishing
summary: Build a package, try it on a server, publish it to the SpaceMIX Hub registry, what its review does (in review, approved or held for an admin, screenshots, rejected), sell it in the Marketplace, and how servers find, install, update and approve permissions.
audience: both
since: protocol 1
---

# Publishing

An extension reaches a server as a package (`ExtensionPackage`, see [Package format](../reference/package-format.md)). This page covers the path from a folder to every server that installs it. The registry's HTTP API is in [Registry](../reference/registry.md); what each permission means for installs and updates is in [Permissions](../reference/permissions.md).

## Build

`npm run build:extensions` in `apps/desktop` (or `node scripts/build-extensions.mjs` from the root) builds each folder in `extensions/` into `dist/extensions/<id>.json` at the repository root, and writes `dist/extensions/index.json` listing what's there.

- **`js`**: one IIFE, built by Vite from the entry file, that assigns the module to `globalThis.__opExtension` (`BUNDLE_GLOBAL`). The modules in `HOST_MODULES` (React, the SDK, `@spacemix/ui`, `lucide-react`, `motion/react`) are left out and read from globals the frame sets, so a bundle is a few tens of KB.
- **`css`**: only the Tailwind utilities the folder's own files use. Colors, radii and fonts resolve through the design tokens (`var(--color-…)`), which the frame defines along with `@spacemix/ui`'s own styles.
- **`manifest`**: read from the built bundle itself, by running it with stand-ins for the host modules.
- **`readme`** (the folder's `README.md`, shown in the store), **`source`** (the folder's text files, so others can read how it's made), **`builtAt`** and **`hash`**: sha256 over the id, version, bundle, CSS and canonical manifest (see [The hash](../reference/package-format.md#the-hash)). The app refuses a package whose hash doesn't match.

`--only <folder>` builds one folder; `--watch` rebuilds a folder when a file in it changes. The [Studio](studio.md) builds the same package in the browser.

The command-line build doesn't run `defineExtension`'s checks on the manifest it reads back (it passes the manifest through). Your own `defineExtension` call runs when the bundle loads, so keep it: it is what catches a bad id or a non-snake_case name before a server sees the package.

## Try it on a server

- **This machine:** a debug build of SpaceMIX installs every package that lands in `dist/extensions/` as it changes. See [Getting started](getting-started.md#the-development-loop).
- **Another server:** open **Extensions** and choose **Import from file** with the `.json` from `dist/extensions/`, or one exported from the Studio (**Export extension file** on a project in **My extensions**, or **Download package** in its settings). The package always goes to the Studio first: your project for that extension gets its source (the files there go into the project's history), or a new project is made, and the Studio opens on it. Importing takes the `server:extensions` permission. From its **Publish** tab that person can install it on that server (**Install on this server**, or **Update on this server** when a version is installed; the owner any id, anyone else a new id or their own earlier build, see [What a member may install](../reference/permissions.md#what-a-member-may-install)) or take it on to the registry (see [Publish](#publish)). Importing and installing work with the Hub off. The server checks the format, the manifest (id, a semver `version`, `name`, `description`, `icon`, `permissions` as a list of strings), the `js`, `css`, `readme` and `builtAt` fields, and the hash, then installs it as a local package, replacing whatever version was installed. Import the file again after rebuilding.
- **Another server, from the command line:** `npm run extensions:install -- --server <url> [<folder or id> …]`, from the repository root, builds the named extensions (all of them when none is named) and installs them straight onto that server as its owner, without the registry or the Studio (`scripts/install-extensions.mjs`). `--no-build` installs what's already in `dist/extensions/`. It signs in only through SpaceMIX Hub, with `SPACEMIX_HUB_EMAIL` and `SPACEMIX_HUB_PASSWORD` (when unset, asked for on a terminal once the Hub is confirmed; the account must own the server), so it doesn't work for an owner with only a local account or a server with the Hub off: use **Import from file** there. It reads `SPACEMIX_SERVER_URL` (instead of `--server`) and `SPACEMIX_HUB_URL` (the Hub to sign in through) from the environment or `.env` in the repository root. If `SPACEMIX_HUB_URL` differs from the Hub the server names (`auth.hub` in `/.well-known/spacemix`), the script refuses before asking for credentials and names both addresses. If it's unset, the server's answer is only a claim: on a terminal the script shows that address and asks you to confirm before asking for credentials, and with `SPACEMIX_HUB_EMAIL` or `SPACEMIX_HUB_PASSWORD` set, or with no terminal, it refuses until you set `SPACEMIX_HUB_URL`. The installs are local packages, like an import.

Someone with the Extensions permission (`server:extensions`) also sees, in **My extensions**, every installed extension they may use that has no Studio project of theirs; **Open in Studio** on one makes a project from the source files its package carries, keeping its id and version, so installing or publishing from the Studio updates the same extension. Installing over an extension that isn't your build stays the owner's. For a paid extension that isn't yours, **Open in Studio** and **Export extension file** aren't offered (and the extension's page has no **Edit in Studio**): a purchase lets a server run it, not copy it.

A local install whose id came from the registry before isn't updated from the registry unless the registry has a higher version. A build made on this server, from a file, the Studio or this machine's build folder, is never replaced on its own: on a server that [uses the Hub](../reference/hub-optional.md#what-uses-the-hub-means), or when someone asks with **Check now**, a listing under its id, at any version, waits for the server's owner (see [When a listing takes a build's id](../reference/permissions.md#when-a-listing-takes-a-builds-id)).

## Publish

Run `node scripts/publish-extensions.mjs` from the repository root after building. For each package in `dist/extensions/` it:

- creates the listing when the registry doesn't have the id,
- publishes a new version when the registry's latest is lower (the listing must be yours),
- skips it otherwise,

printing one line per package. It exits non-zero if any failed.

| Option or setting | Meaning |
|---|---|
| `--only <folder or id>` | Only this extension (the folder name, which is the id's last segment, or the whole id). |
| `--notes "…"` | Release notes. Default: `Built from <git short sha>`. |
| `SPACEMIX_HUB_URL` | SpaceMIX Hub's address. Default `https://spacemix.ai`. When it's unset, the script prints the target and asks for confirmation on a terminal, and refuses without one. |
| `SPACEMIX_HUB_EMAIL`, `SPACEMIX_HUB_PASSWORD` | The publishing account. Read from the environment, else from `.env` in the repository root. The script signs in, publishes and signs out. |

Rules the registry applies (see [Registry](../reference/registry.md) for the full list):

- **Bump `version` to release a change.** A new version must be higher than the listing's highest, by semver; otherwise the registry answers "Version … isn't newer than …".
- **Reserved ids.** SpaceMIX Hub refuses ids under its reserved prefixes (by default `ai.spacemix.`, `dev.operator.` and `core.`) unless the account is one of the Hub's named publishers or admins; `dev.operator.`, the ids from before the rename, is refused for everyone. This is checked for new listings and for new versions of a listing.
- **Size.** SpaceMIX Hub refuses packages over 8 MB.
- **Categories.** Set `categories` in the manifest to file the extension in the Marketplace's category filter: up to 3 ids from `EXTENSION_CATEGORIES`, most fitting first (`categories: ["crm", "communication"]`). Without it the listing is under **Other**. SpaceMIX Hub and the Studio's build refuse an unknown id. The ids are in [Categories](../reference/manifest.md#categories).

The same can be done from the app: **Import from file** brings the package into the [Studio](studio.md), and you go on from its **Publish** tab. That tab offers **Export package** and **Open the publish page**: export the package, then upload it at `{hub}/marketplace/sell/publish`, signed in to SpaceMIX Hub there (`{hub}` is the Hub's address). With the Hub off there is no registry to publish to, and the tab offers the file alone, which installs on another server with **Import from file**. Publishing from the app happens only there; an extension's page in **Extensions** has no **Publish**.

## Review before anyone can install it

Every version you publish is reviewed before anyone else can see or install it. SpaceMIX Hub's review runner installs the version on a throwaway server, reads its code against these docs, uses it in a browser and takes screenshots. The states and routes are in [Version review](../reference/registry.md#version-review).

1. **In review.** Publishing succeeds at once, with the new version `in_review`. Until it's approved, only you and the Hub's admins see it: servers keep the last approved version, updates don't offer the new one, and a listing with no approved version isn't in the Marketplace at all.
2. **Approved automatically, or held for an admin.** A clean review (a `pass`, not unsure, nothing of `medium` severity or above) approves the version on its own. It goes to an admin instead (`needs_admin`) when the review flagged it, failed it, was unsure or didn't finish, and also, however clean the review, when the version is:
   - the listing's **first version**;
   - asking for **new permissions or hosts** that the last approved version didn't have;
   - asking for **broad access**: `net:*`, a wildcard host such as `net:*.example.com`, `tools` or `git`.

   The reason shows on the version, such as `Waiting for an admin: new permissions: net:api.example.com.`. To be approved without waiting, ask for exactly the hosts you need and keep the same permissions from version to version.
3. **Screenshots.** The review's screenshots, at most 12, are the only images your listing shows; you can't upload your own. Under **Review** on your listing's Marketplace page, pick which show and in what order (**Save screenshots**). A re-run of the review shows all of its new screenshots again.
4. **Rejected, with a reason.** An admin may turn a version down; the reason shows on the version. A rejected version number is final: fix what the reason says, raise `version` and publish again.

Where you follow it, all on SpaceMIX Hub's own site: the bell has a notice each time one of your versions changes state (the Hub sends no email); **Marketplace → Sell** shows the waiting version next to each listing (`v1.2.0: In review`); and your listing's Marketplace page (opening a notice, or the listing in **Sell**, goes there) has a **Review** section, seen only by you and the Hub's admins, with each version's state, reason, what the review checked, its findings and its screenshots.

## Selling an extension

An extension can have a price in SpaceMIX Hub's Marketplace (experimental; the routes and rules are in [Marketplace](../reference/market.md)). You sell it yourself: payments go to your own Stripe account, and SpaceMIX Hub keeps a fee (20% by default).

1. On SpaceMIX Hub's own site, signed in with your SpaceMIX ID, open **Marketplace → Sell** (`{hub}/marketplace/sell`).
2. **Connect Stripe**. You make or sign in to a Stripe account (a Stripe Connect Standard account), and finish Stripe's setup. You are the seller of record: tax, invoices and refunds are yours, in your Stripe dashboard. Until Stripe lets the account take payments, your extensions stay free.
3. Pick a price for one of your listings: **One-time**, or **Subscription** per month or per year, in EUR, USD or GBP, from 1.00 to 1,000.00. **Save price**. Picking **Free** again clears it, which is refused while subscriptions to it still run: cancel them in Stripe first.

What a price changes:

- **Which versions are paid.** A version you publish while the listing has a price is paid. Versions published while it was free stay free for everyone. If no server but your own has installed the extension yet, setting a price makes every version paid. Clearing the price makes every version free. See [Free and paid versions](../reference/market.md#free-and-paid-versions).
- **You run it free.** Every server you have signed in to with your SpaceMIX ID in the last 30 days gets your paid extensions free, with no purchase.
- **It is never an essential.** A paid listing isn't offered by **Install essentials**, whatever the Hub recommends.
- **One purchase covers one server.** Everyone on that server uses it. A server whose purchase lapses keeps the extension for 7 more days, then [turns it off](../reference/permissions.md#turned-off-until-its-paid-for) until it is renewed; its data is kept.
- **Copies stay yours.** On other people's servers, **Open in Studio**, **Edit in Studio** and **Export extension file** aren't offered for a paid extension.
- **Builds you install yourself count too.** A build installed from a file, the Studio or a build folder carries the same id, so on a server you aren't on it counts as paid (see [Things to know](outside-the-repo.md#things-to-know)).

**Sell** also lists duplicate payments: a checkout paid for a server that already had the extension. Refund those in Stripe.

## How servers install and update

The server installs packages into its own store, so the whole team has the same extensions. Who may use each one is set per person in **Settings → Permissions** (see [Who can use an extension](../reference/permissions.md#who-can-use-an-extension)); new members start in the **Members** group, which may use every extension.

- **Finding.** Everything published is in the public registry, which takes no account to read. A server with the Hub on lists it under **Browse** in **Extensions**, and it is in the **Marketplace** on SpaceMIX Hub's own site (**Browse**, searchable and filtered by **Categories** and **Price** in its left column, or under **Filters** on a phone). With the Hub off a server has no **Browse**, only what's installed and **Import from file**. An extension's Marketplace page is at `{hub}/marketplace/<id>` (with `{hub}` the Hub's address and `<id>` your manifest `id`), so a link to it opens that page. It has **Get**: pick one of your servers, then a free extension sends you to that server's page for it, to install it there, and a paid one goes to Stripe Checkout first and sends you there once the payment is confirmed. **Marketplace → Purchases** lists what you bought, per server, with **Manage subscription** for a subscription.
- **Installing.** The server installs from the registry when someone with the Extensions permission (the owner has it) installs it, with **Install** on the extension's page in **Extensions**, which is where the Marketplace's **Get** sends them; nothing installs on its own. A free extension needs no account. A paid one shows **Buy on SpaceMIX Hub**, which opens its Marketplace page for this server, and a paid version installs only on a server its purchase covers. **Settings → Extensions** lists the **essentials**, the registry's recommended set, and installs the missing ones that person may use when they click **Install essentials**. Installing, updating and uninstalling an extension also needs access to it. A package that isn't from the registry (a Studio build, an imported file) is installed by the owner, or by someone with `server:extensions` when it is a new id or their own build. A registry install is checked against SpaceMIX Hub's signature over its id, version and hash, and against its own hash. An extension that declares any `net:` permission, `git`, `ai:invoke` or `tools` is installed only after a confirmation that says where its data can go (see [What owners see before installing](../reference/permissions.md#what-owners-see-before-installing)); ask for less and the confirmation says less.
- **Uninstalling.** An uninstalled extension stays uninstalled until someone installs it again (from the Marketplace, or with **Install essentials**). Its data stays on the server, and only people who may use the extension reach it.
- **Deleting.** Your own builds can also be deleted with **Delete extension**, which uninstalls them and can delete your Studio project for them (with `server:extensions` and access to it); the server's owner can also choose to erase their data on the server for good. Anything ever installed from the registry can only be uninstalled. See [Deleting your own build](../reference/permissions.md#deleting-your-own-build).
- **Updates.** Once it [uses the Hub](../reference/hub-optional.md#what-uses-the-hub-means), the server checks for updates at startup and every ten minutes. Before that it doesn't ask on its own; **Check now** in **Extensions → Updates** checks when someone asks. A paid version this server hasn't bought waits as needing a purchase. By default a newer version waits: everyone with the Extensions permission who may use that extension gets a notification and can approve or dismiss it in Extensions. With **Update extensions automatically** on, a newer version installs on its own when the permissions already approved cover it, and everyone who may use the extension gets a notification that it was updated; one that asks for more still waits. A dismissed version comes back only when a newer one is published.
- **Covering.** A permission is covered when it was approved exactly, or when it is a `net:` host that an approved `net:*` or `net:*.example.com` matches. Anything else new, such as `net:*` after `net:api.example.com`, or `chat`, needs approval.

## Frames and reloads

An extension's frame is created the first time its view opens or the assistant calls one of its actions (extensions with the `events` permission start when someone signs in), and stays alive, hidden, after that. An install or update drops the frame, so the next use starts the new package. The store's **Reload** button starts an extension over from its package.
