The native app
A native Android and iOS app with Expo and React Native, which calls the same API as the website, or the API alone.
pnpm dlx @clubedge/create-clubedge-app my-app --framework vite --api hono --mobile expo--mobile expo adds apps/mobile, a native Android and iOS app built with Expo SDK 58 (React 19.3, React Native 0.88) and Expo Router. Its screens are its own, not the website's pages, and it calls the same API with the same contract client, @clubedge/contract: through your website, or directly in a project without a website. It needs CLI 0.44.0 and Starter v0.28.0.
It is not the mobile app (--shell capacitor), which packages the website's own pages with Capacitor. A project can have both.
Try the Starter's native app on an Android phone: download clubedge-native-demo.apk from the latest Starter release and open it, allowing installs from unknown sources when Android asks. It is the app's demo: you sign up and sign in for real, against a live API. Use a password you don't use elsewhere, since the demo's accounts can be deleted at any time. iPhones install apps only from the App Store or TestFlight, so there is no file for them.
Choose it
The native app calls an API, so --mobile expo needs --api hono or --api fastapi, with --framework vite or --framework none:
| Project | The app calls |
|---|---|
--framework vite and its API | The website's address: its server forwards /api to the API and answers sign-in at /api/auth. |
--framework none and an API | The API's own address. See Without a website. |
Next.js and TanStack Start have no separate API for an app to call, and an API is required, so the CLI refuses the rest:
Next.js has no separate API for Expo to call: choose a frontend with an API, or --mobile none.
Expo is a mobile app and calls an API: choose one with --api (fastapi, hono).Interactive runs ask Add a native mobile app? after the API, with Expo and None, the default. In the builder, the Native app row appears once an API is picked. The project's package.json records the choice in "apps", as "mobile": "expo".
A project created without it can add it later, and drop it again, with CLI 0.46.0 or newer: pnpm clubedge add mobile expo, or pnpm clubedge remove mobile (Change a project).
What you get
apps/mobile: the app, package@clubedge/mobile-app. Its screens are routes undersrc/app(Expo Router), and it calls the API only throughsrc/lib/api.ts, the contract client.app.config.tstakes the app's name, id, and address scheme fromsrc/config/site.json, and its icon, Android's adaptive icon, and its splash screen fromassets/..env.localholdsEXPO_PUBLIC_API_URL, the address the app calls.android/andios/are generated fromapp.config.tswhenever the app is built (expo prebuild), so they aren't committed, and an upgrade only changes the app's TypeScript and config. Changeapp.config.ts, never those folders.apps/webis the React + Vite website. A project without a website has none.
The screens
- Sign-in, sign-up, and password reset.
- The dashboard: the signed-in account, the API's health, and the app's version, refreshed when you pull it down. It also says when an update is available.
- Settings: the display name, the password, signing out, and deleting the account, which the App Store requires of apps that let people sign up.
With --auth none, the app has no sign-in and no settings: only the dashboard.
Requirements
The app runs as a development build, not in Expo Go, the store app that runs projects without building them: Expo Go doesn't support SDK 58 yet.
- Android Studio, for Android.
- A Mac with Xcode, for iOS.
Expo's environment setup has the details.
Set it up
Set the app's id
In apps/mobile/app.config.ts, replace the generated com.example.<project> with a reverse-domain id you own, such as com.yourcompany.app. It becomes permanent once a store lists the app, so set it before the first release build. The app's name and its address scheme come from apps/mobile/src/config/site.json.
Start the API
pnpm devIt starts the website and the API, or the API alone in a project without a website. Left blank in development, EXPO_PUBLIC_API_URL means this computer's dev server: the app calls http://10.0.2.2:3000 from the Android emulator and http://localhost:3000 from the iOS simulator, or port 3001 without a website, the API's. On a phone, set it to your computer's address on the same network, with port 3001 without a website:
EXPO_PUBLIC_API_URL=http://192.168.1.20:3000With Supabase Auth, set EXPO_PUBLIC_SUPABASE_URL and EXPO_PUBLIC_SUPABASE_PUBLISHABLE_KEY there too (Sign-in).
Build and run it
pnpm --filter @clubedge/mobile-app android # or ios, on a MacThe first run generates the native project, builds the app, installs it on a running emulator or a connected phone, and starts Expo's dev server, which reloads the app as you change it. Later, pnpm --filter @clubedge/mobile-app start starts the dev server for the build already installed. Build again after adding a package with native code.
Commands
| Command | What it does |
|---|---|
pnpm --filter @clubedge/mobile-app android | Build the app, install it on the Android emulator or a phone, and start Expo's dev server. The first run generates apps/mobile/android. |
pnpm --filter @clubedge/mobile-app ios | The same for iOS, on a Mac. The first run generates apps/mobile/ios. |
pnpm --filter @clubedge/mobile-app start | Start the dev server for the app already installed. |
pnpm --filter @clubedge/mobile-app prebuild | Generate android/ and ios/ from app.config.ts, to build a release in Android Studio or Xcode. |
How it works with the API
- Its address.
EXPO_PUBLIC_API_URLis built into the app. With a website, it is the website's address: its server forwards/apito the API and answers sign-in at/api/auth. Without one, it is the API's, which answers both. - No browser origin. The app sends none, so the CORS settings don't apply to it.
- Its session stays on the device: the app stays signed in offline, and signing out forgets the session even when the server can't be reached.
- No payments. App stores require their own in-app purchases for digital goods, so the app has no billing: subscriptions stay on the website.
Sign-in
Better Auth runs in the website's server, or in the API without a website. Its Expo plugin keeps the session cookie in the device's secure storage and sends it with the app's calls. The server trusts the app's address scheme, which the app sends when it signs in. Both make the scheme from their site config's serviceId, such as my-product://, so keep apps/mobile/src/config/site.json and the server's copy (apps/web/src/config/site.json, or apps/api/src/config/site.json without a website) on the same serviceId.
Firebase Authentication and Appwrite aren't in the native app, so the CLI refuses them with --mobile expo:
Expo does not implement Firebase Authentication (--auth firebase). It implements: supabase, better-auth, none.Emailed links
- With a website, confirmation and password reset links open the website. After confirming an address or setting a new password, sign in again in the app.
- Without one, they open the app through its address scheme: confirming a new account opens its sign-in screen, and a password reset link opens its reset screen, which sets the new password. With Better Auth, this needs an email module. With Supabase Auth, add the scheme to the Redirect URLs in Supabase's URL configuration, such as
my-product://**. The local Supabase stack (--infra supabase) reads them fromadditional_redirect_urlsinsupabase/config.toml: add it there too, and restart the stack.
Updates
An installed app keeps the version it shipped with, often for months. It asks the API's GET /api/app-version which versions the API serves, and compares its own, version in app.json (in app.config.ts before Starter v0.30.0). It asks when it starts, and from Starter v0.29.0 also when it comes back to the foreground (at most every 15 minutes) and whenever the API refuses its version (Apps the API refuses):
- Below
APP_MINIMUM_VERSION, it shows only Update required, with an Update button that opensAPP_UPDATE_URL. From Starter v0.29.0, the app remembers it, so it holds when the app next starts offline, until it is updated. - Below
APP_NEXT_MINIMUM_VERSION(Starter v0.29.0 or newer), the dashboard says the date the app stops working, and Not now hides it until the next day. - Below
APP_LATEST_VERSION, the dashboard says an update is available. From Starter v0.29.0, Not now hides it until a newer version is out. - When the API can't be reached, nothing new shows: a remembered Update required still holds, and otherwise the app carries on.
Set the versions on the API, in apps/api/.env.local or the API's environment in production: see Apps installed on phones. Give version as MAJOR.MINOR.PATCH, such as 1.4.0, and raise it with each release: see Store releases.
Installed apps also keep calling the API contract they shipped with, so CI fails a pull request that breaks it: see Keep the contract compatible.
Store releases
From Starter v0.30.0, the app's version, which the stores show and the update notice compares, is version in apps/mobile/app.json. app.config.ts makes both stores' build number from it, so a new version is a new build: 1.4.2 is build 1004002. A project from Starter v0.29.0 or earlier kept its version in app.config.ts: after upgrading, keep the Starter's app.config.ts, and carry your version over with set-version. Set a newer one for each release:
pnpm --filter @clubedge/mobile-app set-version 1.5.0The app builds with EAS Build, in Expo's cloud, with the profiles in apps/mobile/eas.json:
| Profile | Builds |
|---|---|
development | A development build, with Expo's dev client, to install on your devices |
preview | A release build to share, an APK on Android |
production | The stores' build |
Link the app to an Expo project, from apps/mobile: pnpm dlx eas-cli@latest init, which writes the project's id into app.json.
Give each EAS environment the address the app calls, the website's or, without a website, the API's. It is built into the app, and .env.local stays on your computer:
pnpm dlx eas-cli@latest env:create --environment production --name EXPO_PUBLIC_API_URL --value https://app.example.com --visibility plaintextRun a first build interactively, pnpm dlx eas-cli@latest build --profile production. It sets up the signing credentials EAS then keeps: Android's upload key, and on iOS, with your Apple Developer account, a distribution certificate and a provisioning profile.
From then on, the Native app release workflow (.github/workflows/expo-release.yml, run from the Actions tab) queues builds with an EXPO_TOKEN repository secret (expo.dev, Account settings, Access tokens), for both stores or one, and submits production builds to the stores when asked. Once the stores publish a release, set the API's APP_LATEST_VERSION to it (Updates).
To build on your computer instead, run pnpm --filter @clubedge/mobile-app prebuild, then Android Studio or Xcode, with your own signing key and EXPO_PUBLIC_API_URL in apps/mobile/.env.local.
Push notifications and over-the-air updates
Two modules are for the native app (Starter v0.30.0 or newer):
- Push notifications (
--push expoor--push native): a Notifications switch and a test notification in Settings, sent through Expo's push service or straight through FCM and APNs. - Over-the-air updates (
--ota eas): changes to the app's JavaScript reach installed apps with EAS Update, without a store release.
The demo
Each Starter release from v0.28.0 attaches the Starter's own native app for Android, clubedge-native-demo.apk. It is built from a project without a website, with Hono and Better Auth, and the release deploys that project's API to Render's free plan, so the app's sign-up, sign-in, and settings run against a real server and database. After a quiet spell, the API's first answer takes about a minute while Render wakes it.
CI
The project's CI has an expo job. It checks the app's packages against its Expo SDK (expo install --check), bundles its JavaScript for Android and iOS (expo export), and builds a release APK, signed with a debug key, which it keeps for 7 days as the run's android-release artifact, to install on a device. Set an EXPO_PUBLIC_API_URL repository variable so that the APK calls your website, or your API without one; without it, the APK calls https://example.com.
pnpm audit skips two advisories in Expo's development CLI, which builds and serves the app but isn't part of it: node-forge's, which has no fixed release, and zod 3's. Projects without the native app don't skip them.
Limits
- It needs a separate API: React + Vite with Hono or FastAPI, or an API alone. Next.js and TanStack Start have none for it to call.
- Sign-in is Better Auth, Supabase Auth, or none.
- No in-app payments: subscriptions stay on the website.
- The stores' accounts, listings, and review are yours. The builds, their signing, and their submission are set up: see Store releases.
When the app can't reach the API
The dashboard's API card says which address the app couldn't reach. Check EXPO_PUBLIC_API_URL in apps/mobile/.env.local: a release build needs the website's https:// address, or the API's without a website, and a phone in development your computer's address on the same network, with port 3001 without a website. The value is built into the app, so build it again after changing it.
How is this guide?