Skip to content
Expo LynxExpo Lynx

Quickstart

Install, stand up the Console, wire up the host app, then ship one mini-app release — end to end.

Four steps, in order: install the module, stand up the Console (Worker + D1 + R2), wire the host app to it, then build and ship one mini-app release. Each step only needs what came before it — nothing else.

  1. Add the module and CLI to the Expo host app:

    Terminal window
    pnpm add expo-lynx-view
    pnpm add -D expo-lynx-bundle-cli
  2. Add the Expo config plugin. Leave deliveryEndpoints as a placeholder for now — it gets its real value in step 3:

    app.json
    {
    "expo": {
    "plugins": [["expo-lynx-view", {
    "embeddedBundlesPath": "./generated/expo-lynx/embedded",
    "publicKeyPath": "./keys/lynx/updates.public.pem",
    "deliveryEndpoints": {
    "delivery": "https://placeholder.workers.dev/v1/default/delivery"
    }
    }]]
    }
    }

One Worker, one D1 database, one R2 bucket — created once, shared by every mini-app your team ships.

  1. Create the signing key pair (public half goes to the app, private half goes to the Worker):

    Terminal window
    pnpm lynx keys generate
  2. Decide how release uploads reach R2 — setup asks interactively, so this is optional prep, not a blocker:

    • Wrangler CLI (recommended, preselected): in the Cloudflare dashboard, under My Profile → API Tokens, create a token with Workers R2 Storage: Edit permission. This is the same mechanism hot-updater uses — lynx release shells out to the bundled Wrangler CLI with this token, so no R2 S3 key pair is needed.
    • Direct to R2: in the Cloudflare dashboard, under R2 → Manage R2 API Tokens, create an Object Read & Write token scoped to one bucket. Keep the access-key ID and secret — setup asks for them if you pick this mode.
  3. Run setup — it creates an ignored .env.lynx on first run, then walks you through everything else with interactive prompts (Worker/D1/bucket names, the upload mode from above, a matching credential, and a Console username/password):

    Terminal window
    pnpm lynx console setup

    Setup deploys the Worker, creates D1/R2, applies migrations, and writes the deployed Worker URL, database ID, and CLI API key back into .env.lynx.

  1. Replace the placeholder URL from step 1 with the real Worker URL from .env.lynx:

    app.json
    {
    "deliveryEndpoints": {
    "delivery": "https://your-worker.workers.dev/v1/default/delivery"
    }
    }
  2. host prepare --register authenticates to the Worker, so set these two variables first (in .env.lynx next to the host app’s package.json, or in CI):

    Variable Needed for
    LYNX_DELIVERY_SERVER The Worker URL to register against
    LYNX_DELIVERY_API_KEY Authenticates the registration call

    That’s the full list — the host app never needs R2 credentials or the Worker’s signing private key.

    Embed the mini-app once, then prepare and register the native compatibility record for both platforms:

    Terminal window
    pnpm lynx host embed ../delivery
    pnpm lynx host prepare --register
  3. Render the managed feature:

    <ExpoLynxView source={{ kind: 'managed', feature: 'delivery' }} style={{ flex: 1 }} />
  4. Build the native app as usual. Don’t change native dependencies or the plugin config between host prepare and this build — it invalidates the registration from step 2.

In the mini-app’s own repository (no Expo checkout, no signing key):

  1. Declare its identity — the Console operator must already have registered this exact appId/feature pair:

    lynx-miniapp.config.ts
    import { defineMiniApp } from 'expo-lynx-bundle-cli';
    export default defineMiniApp({
    appId: 'default',
    feature: 'delivery',
    });
  2. lynx release needs more than the host app — it uploads the archive too, not just an API call. Set these (again in .env.lynx, or CI secrets):

    Variable Needed for
    LYNX_DELIVERY_SERVER The Worker URL to upload to
    LYNX_DELIVERY_API_KEY Authenticates the upload
    CLOUDFLARE_ACCOUNT_ID Cloudflare account (both upload modes)
    LYNX_DELIVERY_R2_BUCKET Target R2 bucket (both upload modes)
    CLOUDFLARE_API_TOKEN Wrangler-CLI upload (the default)
    R2_ACCESS_KEY_ID Direct-to-R2 upload only
    R2_SECRET_ACCESS_KEY Direct-to-R2 upload only

    Which pair you need (CLOUDFLARE_API_TOKEN or the two R2_* variables) depends on the upload mode the Console operator chose during setup (LYNX_DELIVERY_UPLOAD_MODE in their .env.lynx). Testing locally against pnpm lynx console, neither pair is needed — the local Worker offers its own upload URL.

    Build and upload a release:

    Terminal window
    pnpm lynx release
  3. Open the Console, select the verified release, and enable it. Uploading never enables a bundle by itself — that’s a deliberate, separate step.

That’s the whole loop: a device with the host app installed now fetches, verifies, and renders that release the next time it checks in.


Next: Lifecycle for how embedded vs. remote selection actually works, Local development to test all of this on your Mac before touching Cloudflare, or Troubleshooting if a step above didn’t behave as described.