CControxity Docs
GuidesReferenceHTTP APIOpen Controxity
Platforms

Phone apps (through your server)

A phone or desktop app's crashes, sent through your own server. No key in the app, and no store update to start.

Why through your server#

A key inside an app can be copied by anyone who has the app. So a phone app sends its crashes to your server, as it already talks to it, and your server passes them on with its own key. Nothing about Controxity is in the app.

1. In the app: send crashes to your server#

Catch what the app's runtime reports and post it to your own API, with the app's version and platform:

ErrorUtils.setGlobalHandler((error, isFatal) => {
  fetch("https://api.example.com/client-errors", {
    method: "POST",
    headers: { "content-type": "application/json" },
    body: JSON.stringify({ message: String(error?.message ?? error), stack: error?.stack ?? "",
                           version: Application.nativeApplicationVersion, platform: Platform.OS, fatal: isFatal }),
  }).catch(() => {});
});

Your app keeps its own crash screen. The message goes only to your server.

2. On your server: pass it on#

app.post("/client-errors", express.json(), (req, res) => {
  const { message, stack, version, platform } = req.body;
  controxity.captureClient({ message, stack, version, platform, component: "mobile" });
  res.sendStatus(204);
});

Only the error's type (the word before the first : of the message) and where it happened leave your server. platform is android, ios, huawei, windows, mac, linux or web, so a fix says where it has to go.

3. Say which versions phones run#

When a phone talks to your API, tell Controxity which version it is. Then a fix shows Running when it has reached phones, not only when it's in the code:

controxity.clientVersion("android", req.headers["x-app-version"], {
  native: req.headers["x-app-native"],     // the store build (Expo: Application.nativeApplicationVersion)
  runtime: req.headers["x-app-runtime"],   // what over-the-air updates must match (Expo: Updates.runtimeVersion)
});

With native and runtime, Controxity knows by itself when a change needs a new store build, and holds over-the-air updates until phones have it.

Store builds through the helper#

Controxity's helper makes each new version for a phone place on a machine you choose: an over-the-air update, a new store build, or whichever the version needs. Everything but one line is done on the page:

  1. Where it runs → Add a place it runs: production, Android (or iOS), its phone part, a name such as Google Play. Press Add.
  2. Under Setup, press Controxity's helper does it.
  3. Say how phones get it. Read from your code: no expo-updates (or EAS Update) means store builds; with it, updates, store builds when needed. Press the other button if that's wrong.
  4. Press Make the install command. It gives the place a new key and makes one line with it and the commands it found in your code. Run that line on the machine that builds the app, in its git checkout. That machine needs no access to GitHub or GitLab: a commit it can't fetch comes from Controxity.
  5. The step ticks itself when the helper first asks Controxity for work, within a minute.

The last two Setup steps (crashes, and which versions phones run) tick when phones first report through your server: for a new iPhone place, the first time someone opens the app on an iPhone. Until then the place isn't counted as quiet or not connected, since its helper asking for work shows it's set up.

The commands in the install line#

The line carries up to two commands, run by the helper for each version you send:

OptionWhen it runsFound in your code
--update CMDA version an over-the-air update can carry. Exit 0 = published; exit 3 = "the native layer changed, make a store build" (the helper then runs --build for the same version); anything else = failed.scripts/publish-update.sh (or publish-ota.sh, update.sh), run as bash scripts/publish-update.sh "Version $CONTROXITY_VERSION", so it's told what it carries.
--build CMDA version that needs a new store build, or every version for an app with store builds only.scripts/build-play.sh, scripts/build-android.sh (Android) or scripts/build-ios.sh (iOS); scripts/build.sh for either. For an Expo app on EAS with none of these, an EAS build (below).

Change either in the line if yours is another. A script whose first line asks for bash (#!/usr/bin/env bash) is run with bash even when the line says sh.

What the helper does for each version#

  1. Asks Controxity every minute. Controxity says which version, which commit, whether it wants an update or a store build, and the place's platform. It never sends a command.
  2. Refuses a commit that isn't on a remote's main (origin/main, upstream/main…), and fetches one no remote has from Controxity.
  3. Puts that exact commit in its own copy of the code, .git/controxity/deploy-<kind>-<channel>/ in your checkout. Your working folder is never touched: whatever branch you or your team are on, with whatever you haven't committed, nothing of it goes into the build.
  4. Copies in the files git doesn't have that a build needs (next section) and installs the phone app's packages there.
  5. Writes the version's number into the app's app.json in that copy, for a store build (see below).
  6. Runs the command, with the variables below set.
  7. Sends what a store build made (.aab, .apk, .ipa, or an installer) to Controxity, and says how it went. The place shows built: upload it to the store with Download, or deployed: waiting for it to report it for an update.

The variables your command gets:

VariableHolds
CONTROXITY_VERSIONThe version's number, 0.1.49.
CONTROXITY_COMMITThe full commit.
CONTROXITY_PLATFORMThe place's platform, android or ios: one update script can serve both.
CONTROXITY_CHANNELupdate-production or build-production (the kind, then the place's channel).
CONTROXITY_CLIThe helper's own copy of the command line, for node "$CONTROXITY_CLI" eas-build ios.

One version at a time per checkout: a second helper for the same checkout (Google Play and iOS) waits for the first.

Files it brings from your checkout#

Git doesn't have your secrets, so the helper's copy gets them from your checkout before each run:

Anything else a build needs from outside git (an upload key in your home folder) is read where it is, by its full path.

The phone app's packages#

Before an update or a build on this machine, the helper installs the phone app's packages in its copy: npm ci, or yarn, pnpm or bun by the lockfile, in every folder whose package.json has expo or react-native. It does it again only when the lockfile changes, so the second run starts at once. Without them expo export fails, and Expo's fingerprint of the native layer comes out different from your checkout's, so every update would look like it needs a store build. An EAS build installs in Expo's cloud, so it isn't done for one.

The version's number in the build#

For a store build, each Expo app.json in the helper's copy gets the version's number (your checkout isn't changed):

Your appexpo.extra.releaseexpo.version
No over-the-air updates (InvoChef)0.1.490.1.49, so the store shows the release
With expo-updates (Voxity)0.1.49unchanged: with runtimeVersion's appVersion policy it is the build's runtime, and a new one would stop the updates published for it reaching that build
Runtime version from a fingerprintunchangedunchanged: any change would change the fingerprint

Read it in the app, falling back to what an update was told:

const release = process.env.EXPO_PUBLIC_VERSION || Constants.expoConfig?.extra?.release;

Send it with your requests as x-app-version, so step 3 sees which version phones run. The version code (Android) and build number (iOS) stay your build's own, and only have to go up.

iOS without a Mac: building on EAS#

An Expo app built with EAS needs no Mac. When the app's folder has an eas.json with a production build profile and you have no build script, the line's build command is:

node "$CONTROXITY_CLI" eas-build ios --dir app

The helper starts the build in Expo's cloud from any computer, Linux too, waits for it (15 to 30 minutes, more when Expo's queue is long), downloads the .ipa to ~/controxity-builds/ and sends it to Controxity. android works the same way, for an .aab. Two things first, once:

  1. Expo's robot token in the app's .env (at the top of the checkout or in the app's folder): EXPO_TOKEN=..., from expo.dev → your organization → Access tokens.
  2. The app's signing on EAS: run npx eas-cli build -p ios once by hand in the app's folder. It asks for your Apple account and keeps the certificate and profile on EAS. The run ends with "All credentials are ready"; you can stop waiting for that first build with Ctrl+C.

The build number is EAS's own when eas.json says "appVersionSource": "remote" and "autoIncrement": true. The helper uploads its copy of the code as it is (not what git has), so the version's number it wrote goes with it.

Your server first#

When phones get their over-the-air updates from your own server, an update for a version can only go out once that server runs the version. Controxity learns which server that is when phones report their versions through it, or when an update is refused naming it (Voxity's says deploy 0.1.49 to Voxity live first). A new phone place whose phones haven't talked yet (a new iPhone place) waits for the same server as the product's other phone place.

On Releases the server shows step 1: phones get 0.1.49's update from it, and each phone place step 2: once Voxity live runs 0.1.49, its button disabled. A version sent to a phone place first goes to the server; the phone place's turn comes when the server reports the version, with no second yes. A store build doesn't wait: it carries everything itself.

While it runs#

4. Roll an update out in stages (optional)#

If your server gives phones their over-the-air updates, it can give a new one to a share of phones first, and widen it while its health holds:

const r = (await controxity.rollouts()).find((x) => x.platform === "android");
const version = controxity.inRollout(r, installId) ? r.version : r.previous;

The same phone always gets the same answer, so a phone that got the update keeps it as the share grows. Turn stages on under Where it runs → the store place. A rollout that looks worse stops by itself.

Controxity 1.132.0These pages are in the repository: docs/site