Skip to content

Getting started

This page takes your app from no KeepSnappy to a result on a pull request. The walkthrough uses an iOS simulator in GitHub Actions. You run one command and change no app code. Your own part takes about 30 minutes. Then CI measures your main branch 3 times, so that KeepSnappy has something to compare your pull requests with.

For Android, a phone on a cable or real phones on BrowserStack, see Choose your setup. Prefer to have Claude Code or Codex do these steps? See Set up with a coding agent.

What you need

  • A KeepSnappy account. KeepSnappy opens to everyone on 15 December. Until then, ask an owner of your team to add you, or write to support@keepsnappy.com (Get access).
  • A CI key, so that your CI can upload measurements to KeepSnappy. Only an owner or admin of your organization can make one. If you aren’t one, ask one to make it for you.
  • An Expo app, or a bare React Native app with the expo package and Expo modules. If a bare app has none, add them with npx install-expo-modules@latest, Expo’s own tool, then follow Bare React Native.
  • End-to-end tests in Maestro, Appium or e2e that already pass on an iOS simulator or an Android emulator in GitHub Actions. KeepSnappy measures your app while these tests run. If init cannot use your emulator job, follow the manual Android setup.
  • Node.js 22.12 or newer. The keepsnappy command runs on it.
  • The GitHub CLI, gh, signed in with the right to add repository secrets. Init uses it to store your CI key in GitHub. Without it, init tells you how to add the key by hand.

1. Set up your app

This step adds the SDK that measures your app, and a CI workflow that runs your tests with it.

Use the CI key you copied when you created your workspace. If your app has no CI key yet, an owner or admin can open Setup on the dashboard and choose Make a CI key.

If your app’s measurement build needs an SDK key, open Setup, then Set up your app and Builds that send their own measurements. An owner or admin can choose Make an SDK key there. To replace a key, choose Make a new SDK key and confirm. The previous SDK key keeps working for 7 days while you update the measurement build.

The CI key starts runs and reads results. It also uploads measurements. Store it as the KEEPSNAPPY_KEY secret in CI. It is shown once and must stay private.

In your app’s repository, start from a clean working tree, so that you can commit exactly what init changes. Use your app’s package manager and the Node.js version it requires.

Package managerPreview the changesApply the changes
npmnpx @keepsnappy/agent init --detectnpx @keepsnappy/agent init
pnpmpnpm dlx @keepsnappy/agent init --detectpnpm dlx @keepsnappy/agent init
Yarn 2 or neweryarn dlx @keepsnappy/agent init --detectyarn dlx @keepsnappy/agent init

With --detect, init changes nothing and asks nothing. It names what it found, such as your test tool and the workflow that runs your tests, and shows each change it would make as a diff.

If you use Yarn 1, or npm refuses to start with a package-manager error such as EBADDEVENGINES, run npx from outside the repository. Pass the absolute path to the app with --dir. Init still uses the app’s package manager when it installs dependencies.

Terminal window
npx @keepsnappy/agent init --detect --dir "/absolute/path/to/your-app"

When the preview looks right, run the apply command. If you used --dir, keep it and remove --detect. Init asks up to three questions:

  1. Whether to add a nightly run at 02:17 UTC. Say yes. It keeps main measured on days nobody merges, so pull requests are compared with recent measurements. It uses GitHub runner minutes each night.
  2. Whether to apply the changes it shows. Say yes.
  3. Whether to store a key as the GitHub secret KEEPSNAPPY_KEY. Say yes, and paste your CI key. Init checks the key, stores it with gh and never writes it to a file.

If init runs without a terminal, such as in a script or a coding agent, it can’t ask. Run it with --yes and --nightly, then store the key on its own (how).

Init changes these files and nothing else:

  • package.json and your lock file: the SDK, @keepsnappy/react-native, and the keepsnappy command, @keepsnappy/agent, at versions that work together.
  • app.json: the SDK’s plugin.
  • metro.config.js: a wrapper around your Metro config, or a new file.
  • keepsnappy.yml: KeepSnappy’s settings for this app.
  • .gitignore: the two folders KeepSnappy writes to.
  • .github/workflows/keepsnappy.yml: a new workflow, copied from the job that runs your tests today. It builds your app with KEEPSNAPPY=1, which puts the SDK in the build, and runs your tests through keepsnappy run.

Your other workflows and your app’s code stay as they are. Builds without KEEPSNAPPY=1, such as your store builds, don’t carry the SDK (Store builds).

At the end, init runs keepsnappy doctor --group app, which checks the app’s setup (doctor). It prints one line per check, and every line should start with ok. Under a line that doesn’t, it says what to fix.

If init stops with Cannot go on: The iOS bundle id is not in app.json or the Xcode project., run it again with --bundle-id and the bundle id of your Release build. For a line that starts with By you:, a missing workflow or anything else, see If init stops or leaves something to you.

With pnpm or yarn, init installs with your package manager. Run the keepsnappy command through it too, where these pages say npx --no-install keepsnappy:

Terminal window
pnpm exec keepsnappy doctor --group app
yarn keepsnappy doctor --group app

If init generates a CI workflow, that workflow builds the app for measurement. If you build it yourself or bring a build to a device farm, follow Make a Release build.

A bare React Native app has a few more steps after init (Bare React Native).

2. Push it and open a pull request

The pull request runs the new workflow once, which shows that the setup works in your CI before you merge it. Commit what init changed, push it, and open a pull request:

Terminal window
git switch -c add-keepsnappy
git add -A
git commit -m "Add KeepSnappy"
git push -u origin add-keepsnappy
gh pr create --fill

A bare React Native app also commits ios/Podfile.lock.

The pull request starts the KeepSnappy workflow. One run of it is a session. A session builds your app, runs your journeys and uploads the measurements. Each journey runs 5 times per session. A journey is one Maestro flow, or your whole test command with Appium or e2e. Maestro users: see one journey per flow, or one for the suite.

When the job ends, the KeepSnappy check passes. Each journey reads No main to compare, with the reason Main had no runs on this phone when this branch ran. That is expected: main has no measurements yet. Merge the pull request, then step 3 measures main.

3. Measure main 3 times

KeepSnappy compares every pull request with the last 3 measurements of your main branch. Until main has 3, pull requests show “Can’t tell”.

Before you measure main, set up each journey to use the same data every run: the same account, content, date and settings. Different data means different work, which can read as a slowdown your code did not cause.

Once the KeepSnappy setup (the files init added) is on main, run the KeepSnappy workflow on main 3 times:

Terminal window
gh workflow run keepsnappy.yml --ref main
gh workflow run keepsnappy.yml --ref main
gh workflow run keepsnappy.yml --ref main

Without the terminal: on GitHub open Actions → KeepSnappy → Run workflow on main, 3 times.

After the third measurement finishes, every new pull request gets a result.

If your main branch has another name, use it instead of main.

The 3 sessions can run at the same time. Each takes one build, plus 5 passes of your journeys, plus a few minutes to upload and wait for the result. Init sets the job’s timeout-minutes to at least 90. If your build and tests take longer, raise it (Budget the first session). With e2e (e2e.com), the whole command runs on every repetition: for the first sessions, narrow it to a few test files.

Pin the Xcode version and the simulator’s device type in the job. A pull request is compared with main on the same phone model, and a new model starts the history of main again.

From now on, the workflow also runs on every push to main and on every pull request.

4. Open a pull request, read the result

This checks that the setup is finished: from now on, every pull request gets a result like this one. Open any pull request, even one with a one-line change. When the KeepSnappy job ends, each journey has one result:

ResultWhat it means
WorseA place added one frame (16.7 ms) or more in every run, or the app kept much more memory than on main.
Slightly worseSomething got slower or kept more memory, but not enough for Worse.
No changeNothing judged got slower, and nothing got faster.
BetterSomething got faster, and nothing got slower. Today’s rules do not give it yet.
Can’t tellKeepSnappy couldn’t compare, or too few places could be judged. The reason is shown with the result.

Results gives the exact rules. Until main has 3 sessions on a phone model, its pull requests read No main to compare (no sessions yet) or Can’t tell (fewer than 3).

You can read the result in three places:

  • On GitHub: open the KeepSnappy check’s Details, then the workflow run’s Summary. With gh, gh run view <run id> --log prints the job log, which has the same result after KeepSnappy result for.
  • On the dashboard: open Branches, then your branch.
  • In a terminal, with your CI key in KEEPSNAPPY_KEY: npx --no-install keepsnappy status --branch <your branch>.

During the pilot, a Worse does not fail your CI, because init sets verdict_gate: advisory in keepsnappy.yml. The KeepSnappy check passes, and the result still says Worse. Required or advisory checks explains the setting.

Next