Skip to main content
By the end of this guide your Forge project has a second frontend, an Expo React Native app in frontends/mobile, with a screen that lists products from your API. It does not get a hand-written client: forge generate writes the same typed hooks into it that the web frontend uses, from the same proto, so a new RPC reaches both apps on the next generate.

Before you begin

  • A Forge Go project with an entity: Build a Go and React app. The examples use its CatalogService and Product.
  • Node.js and npm. To run the app on a phone, the Expo Go app or an emulator.
  • Forge v1.6.1 or later in the project (reliant forge --version).
1

Scaffold the app

terminal
Output (trimmed)
The scaffold installs the app’s dependencies and ends with a forge generate. What it wrote:
2

Point TypeScript and Metro at the generated code

The generated protobuf code imports its neighbours as ./x_pb.js, and the hooks import @reliantlabs/forge-web-runtime/service-hooks through the package’s exports map. Expo’s defaults resolve neither, so give the app two settings. In frontends/mobile/tsconfig.json, add to compilerOptions:
frontends/mobile/tsconfig.json
And in frontends/mobile/metro.config.js, just above module.exports = config;:
frontends/mobile/metro.config.js
3

Call the API from a screen

Replace the placeholder screen with a product list:
frontends/mobile/app/index.tsx
The hook is an ordinary TanStack Query hook, so data is typed as ListProductsResponse, and useCreateProduct invalidates this list when a product is added.
4

Check that it typechecks and bundles

terminal
Output (trimmed)
A typecheck with no errors and an exported bundle mean every generated import resolves in the app’s bundler, not only in your editor.
5

Run it against your dev API

Start the API with reliant forge env up dev and note its URL (api http://localhost:8085 in the summary). On a phone or emulator, localhost is the device itself, so point the app at an address the device can reach, such as your computer’s LAN address, and start Expo’s dev server from the app’s directory:
terminal
Scan the QR code with Expo Go. Every RPC requires sign-in by default, and the app sends no credentials yet, so the screen shows an unauthenticated error (missing Authorization header) until you wire a sign-in (below).
6

Keep the app out of hosted deploys

The scaffold also adds the app to the staging and prod bundles in deploy/kcl/staging/main.k and deploy/kcl/prod/main.k. Reliant hosting serves web frontends; it does not build or serve a native app. Delete these lines from both files:
deploy/kcl/prod/main.k
Then check that the env declares only your web frontend:
terminal
Output (trimmed)

What this does not do

  • It does not ship the app to phones. Reliant hosting does not build, sign, host or distribute iOS or Android apps. Build and submit them with Expo’s own tools (EAS Build and Submit) or Xcode and Android Studio.
  • It does not sign users in. The scaffold ships a mock session provider, so the app attaches no token. Implement AuthProvider in src/lib/auth/provider.ts over your identity source, then call setAuthTokenGetter(() => provider.getToken()) in app/_layout.tsx, as the comment there shows. Until then, only RPCs with auth_required: false answer the app.
  • It does not design the app. The scaffolded screen is a placeholder.

Troubleshooting

npm run typecheck is resolving with Expo’s default moduleResolution: node. Add the two compilerOptions from the second step.
Metro cannot map the generated .js import to the .ts file. Add the resolveRequest function from the second step to metro.config.js, then restart expo start.
env up dev tries to start the app with npm run dev, which an Expo app does not have. The API is unaffected. Start the app yourself with npx expo start from frontends/mobile.

Next steps

Add a custom RPC

Add an RPC; its hook appears in both frontends on the next generate.

Add sign-in with passkeys

Set up the identity your mobile sign-in will use.

Build the UI before the backend

Work on screens against mock data.

Adding features

Every scaffold forge offers, frontends included.