---
title: Run Whyo locally
description: Start Convex, the two Workers, the apps and these docs on your machine.
---

You need Node 22.19+ and pnpm 10. Test the iPhone app with Expo Go; the Mac app and native iOS builds need Xcode 26.

## First run

1. **Install**

    ```bash
    pnpm install
    ```

2. **Link Convex**

    Local development uses the **dev** deployment (`chatty-bear-591`). Sign in once with `npx convex login`, then:

    ```bash
    cd packages/backend && npx convex dev --once --configure existing --team jay-suthar --project whyo-app --dev-deployment cloud
    ```

3. **Add secrets**

    Copy `apps/api/.dev.vars.example` to `apps/api/.dev.vars` and fill in a Google OAuth client and a `MEDIA_SIGNING_SECRET` (the same value as in Convex).

## Every day

One command starts everything an app needs:

| Command | Starts |
| --- | --- |
| `pnpm dev:mobile` | Convex, the api and mcp workers, and Metro for Expo Go |
| `pnpm dev:desktop` | Convex, the api and mcp workers, and the Mac app |
| `pnpm dev:services` | Convex and both workers only |
| `pnpm dev:docs` | This site at http://localhost:4321 |
| `pnpm dev` | All of the above |

On start, the api worker applies local D1 migrations and copies its signing keys into Convex (`AUTH_JWKS`) if they changed. Convex cloud can't reach `localhost`, so this is what makes sign-in work locally.

Stop everything with `Ctrl+C`.

## Testing on your iPhone with Expo Go

`pnpm dev:mobile` needs no Xcode. Install **Expo Go** from the App Store, put the phone on the same Wi-Fi as your Mac, and scan the QR code in the terminal.

- The app talks to the api worker at `https://api-dev.whyo.app` (or your Mac's Wi-Fi address without the tunnel), which `dev:mobile` sets for you.
- The api worker points Convex's `MEDIA_BASE_URL` at the same address, so photos and videos load on the phone.
- The **share extension** isn't part of Expo Go. To test it, build the native app with `pnpm --filter @whyo/mobile ios` (needs Xcode 26).

:::note[Google sign-in on a phone]
Google only accepts `localhost` or HTTPS sign-in callbacks, and a phone can't reach `localhost` on your Mac. So local development runs the api worker behind a Cloudflare Tunnel at **`https://api-dev.whyo.app`**.

Set it up once per Mac (after `cloudflared tunnel login` for `whyo.app`):

```bash
pnpm tunnel:setup
```

From then on `pnpm dev`, `dev:mobile` and `dev:desktop` start the tunnel too, and point Better Auth, Convex (`AUTH_ISSUER_URL`, `MEDIA_BASE_URL`), the MCP worker and both apps at it. Your Google OAuth client needs `https://api-dev.whyo.app` as a JavaScript origin and `https://api-dev.whyo.app/api/auth/callback/google` as a redirect URI.

Without the tunnel everything falls back to your Mac's Wi-Fi address, where only Google sign-in on a phone doesn't work.
:::

`pnpm dev:desktop` needs Xcode 26.

## Convex environment

| Variable | Dev value |
| --- | --- |
| `AUTH_ISSUER_URL` | `http://localhost:8787` |
| `AUTH_JWKS` | Set by `jwks:sync` |
| `MCP_RESOURCE_URL` | `http://localhost:8788/mcp` |
| `MEDIA_BASE_URL` | `http://localhost:8787` |
| `MEDIA_SIGNING_SECRET` | Same as the api worker's |
