@ramonclaudio/create-vexpo 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/README.md +50 -0
  2. package/dist/index.js +183 -0
  3. package/dist/templates/default/.eas/workflows/asc-events.yml +84 -0
  4. package/dist/templates/default/.eas/workflows/deploy-production.yml +129 -0
  5. package/dist/templates/default/.eas/workflows/development-builds.yml +19 -0
  6. package/dist/templates/default/.eas/workflows/e2e-tests.yml +42 -0
  7. package/dist/templates/default/.eas/workflows/pr-preview.yml +98 -0
  8. package/dist/templates/default/.eas/workflows/release.yml +44 -0
  9. package/dist/templates/default/.eas/workflows/rollback.yml +86 -0
  10. package/dist/templates/default/.eas/workflows/rollout.yml +84 -0
  11. package/dist/templates/default/.eas/workflows/rotate-apple-jwt.yml +42 -0
  12. package/dist/templates/default/.eas/workflows/testflight.yml +57 -0
  13. package/dist/templates/default/.github/workflows/check.yml +28 -0
  14. package/dist/templates/default/.maestro/launch.yaml +18 -0
  15. package/dist/templates/default/AGENTS.md +79 -0
  16. package/dist/templates/default/DESIGN.md +331 -0
  17. package/dist/templates/default/LICENSE +21 -0
  18. package/dist/templates/default/README.md +153 -0
  19. package/dist/templates/default/SETUP.md +618 -0
  20. package/dist/templates/default/__tests__/convex/constants.test.ts +49 -0
  21. package/dist/templates/default/__tests__/convex/validators.test.ts +23 -0
  22. package/dist/templates/default/__tests__/convex/webhook.test.ts +343 -0
  23. package/dist/templates/default/__tests__/lib/deep-link.test.ts +67 -0
  24. package/dist/templates/default/_easignore +22 -0
  25. package/dist/templates/default/_editorconfig +9 -0
  26. package/dist/templates/default/_env.example +34 -0
  27. package/dist/templates/default/_fingerprintignore +24 -0
  28. package/dist/templates/default/_gitattributes +7 -0
  29. package/dist/templates/default/_gitignore +69 -0
  30. package/dist/templates/default/_oxfmtrc.json +3 -0
  31. package/dist/templates/default/_oxlintrc.json +34 -0
  32. package/dist/templates/default/app/(app)/(tabs)/(home)/index.tsx +50 -0
  33. package/dist/templates/default/app/(app)/(tabs)/(home,search)/_layout.tsx +44 -0
  34. package/dist/templates/default/app/(app)/(tabs)/(search)/index.tsx +247 -0
  35. package/dist/templates/default/app/(app)/(tabs)/_layout.tsx +77 -0
  36. package/dist/templates/default/app/(app)/(tabs)/settings/_layout.tsx +37 -0
  37. package/dist/templates/default/app/(app)/(tabs)/settings/index.tsx +362 -0
  38. package/dist/templates/default/app/(app)/(tabs)/settings/preferences.tsx +184 -0
  39. package/dist/templates/default/app/(app)/_layout.tsx +73 -0
  40. package/dist/templates/default/app/(app)/debug.tsx +389 -0
  41. package/dist/templates/default/app/(app)/help.tsx +254 -0
  42. package/dist/templates/default/app/(app)/linked.tsx +116 -0
  43. package/dist/templates/default/app/(app)/privacy.tsx +159 -0
  44. package/dist/templates/default/app/(app)/profile.tsx +915 -0
  45. package/dist/templates/default/app/(app)/sessions.tsx +191 -0
  46. package/dist/templates/default/app/(app)/welcome.tsx +140 -0
  47. package/dist/templates/default/app/(auth)/_layout.tsx +31 -0
  48. package/dist/templates/default/app/(auth)/forgot-password.tsx +168 -0
  49. package/dist/templates/default/app/(auth)/reset-password.tsx +314 -0
  50. package/dist/templates/default/app/(auth)/sign-in.tsx +453 -0
  51. package/dist/templates/default/app/(auth)/sign-up.tsx +563 -0
  52. package/dist/templates/default/app/+native-intent.tsx +14 -0
  53. package/dist/templates/default/app/+not-found.tsx +51 -0
  54. package/dist/templates/default/app/_layout.tsx +102 -0
  55. package/dist/templates/default/app-store/screenshots/.gitkeep +0 -0
  56. package/dist/templates/default/app-store/screenshots/README.md +13 -0
  57. package/dist/templates/default/app.config.ts +201 -0
  58. package/dist/templates/default/app.json +11 -0
  59. package/dist/templates/default/assets/brand-icon-dark.png +0 -0
  60. package/dist/templates/default/assets/brand-icon-light.png +0 -0
  61. package/dist/templates/default/assets/fonts/Geist-Black.ttf +0 -0
  62. package/dist/templates/default/assets/fonts/Geist-BlackItalic.ttf +0 -0
  63. package/dist/templates/default/assets/fonts/Geist-Bold.ttf +0 -0
  64. package/dist/templates/default/assets/fonts/Geist-BoldItalic.ttf +0 -0
  65. package/dist/templates/default/assets/fonts/Geist-ExtraBold.ttf +0 -0
  66. package/dist/templates/default/assets/fonts/Geist-ExtraBoldItalic.ttf +0 -0
  67. package/dist/templates/default/assets/fonts/Geist-ExtraLight.ttf +0 -0
  68. package/dist/templates/default/assets/fonts/Geist-ExtraLightItalic.ttf +0 -0
  69. package/dist/templates/default/assets/fonts/Geist-Italic.ttf +0 -0
  70. package/dist/templates/default/assets/fonts/Geist-Light.ttf +0 -0
  71. package/dist/templates/default/assets/fonts/Geist-LightItalic.ttf +0 -0
  72. package/dist/templates/default/assets/fonts/Geist-Medium.ttf +0 -0
  73. package/dist/templates/default/assets/fonts/Geist-MediumItalic.ttf +0 -0
  74. package/dist/templates/default/assets/fonts/Geist-Regular.ttf +0 -0
  75. package/dist/templates/default/assets/fonts/Geist-SemiBold.ttf +0 -0
  76. package/dist/templates/default/assets/fonts/Geist-SemiBoldItalic.ttf +0 -0
  77. package/dist/templates/default/assets/fonts/Geist-Thin.ttf +0 -0
  78. package/dist/templates/default/assets/fonts/Geist-ThinItalic.ttf +0 -0
  79. package/dist/templates/default/assets/fonts/Geist-Variable-Italic.ttf +0 -0
  80. package/dist/templates/default/assets/fonts/Geist-Variable.ttf +0 -0
  81. package/dist/templates/default/assets/fonts/GeistMono-Bold.ttf +0 -0
  82. package/dist/templates/default/assets/fonts/GeistMono-BoldItalic.ttf +0 -0
  83. package/dist/templates/default/assets/fonts/GeistMono-Italic.ttf +0 -0
  84. package/dist/templates/default/assets/fonts/GeistMono-Medium.ttf +0 -0
  85. package/dist/templates/default/assets/fonts/GeistMono-MediumItalic.ttf +0 -0
  86. package/dist/templates/default/assets/fonts/GeistMono-Regular.ttf +0 -0
  87. package/dist/templates/default/assets/fonts/GeistPixel-Square.ttf +0 -0
  88. package/dist/templates/default/assets/icon.png +0 -0
  89. package/dist/templates/default/assets/sounds/notification.wav +0 -0
  90. package/dist/templates/default/assets/splash-image-dark.png +0 -0
  91. package/dist/templates/default/assets/splash-image-light.png +0 -0
  92. package/dist/templates/default/bun.lock +1860 -0
  93. package/dist/templates/default/components/auth/otp-verification.tsx +255 -0
  94. package/dist/templates/default/components/auth/password-field.tsx +121 -0
  95. package/dist/templates/default/components/auth/segmented-toggle.tsx +47 -0
  96. package/dist/templates/default/components/ui/convex-error.tsx +32 -0
  97. package/dist/templates/default/components/ui/error-boundary.tsx +57 -0
  98. package/dist/templates/default/components/ui/loading-screen.tsx +31 -0
  99. package/dist/templates/default/components/ui/material.tsx +94 -0
  100. package/dist/templates/default/components/ui/offline-banner.tsx +58 -0
  101. package/dist/templates/default/components/ui/prominent-button.tsx +71 -0
  102. package/dist/templates/default/components/ui/skeleton.tsx +107 -0
  103. package/dist/templates/default/components/ui/status-text.tsx +49 -0
  104. package/dist/templates/default/components/ui/update-banner.tsx +82 -0
  105. package/dist/templates/default/constants/layout.ts +102 -0
  106. package/dist/templates/default/constants/theme.ts +401 -0
  107. package/dist/templates/default/constants/ui.ts +77 -0
  108. package/dist/templates/default/convex/_generated/api.d.ts +77 -0
  109. package/dist/templates/default/convex/_generated/api.js +23 -0
  110. package/dist/templates/default/convex/_generated/dataModel.d.ts +60 -0
  111. package/dist/templates/default/convex/_generated/server.d.ts +143 -0
  112. package/dist/templates/default/convex/_generated/server.js +93 -0
  113. package/dist/templates/default/convex/admin.ts +102 -0
  114. package/dist/templates/default/convex/auth.config.ts +6 -0
  115. package/dist/templates/default/convex/auth.ts +335 -0
  116. package/dist/templates/default/convex/constants.ts +46 -0
  117. package/dist/templates/default/convex/convex.config.ts +11 -0
  118. package/dist/templates/default/convex/crons.ts +42 -0
  119. package/dist/templates/default/convex/email.ts +109 -0
  120. package/dist/templates/default/convex/env.ts +31 -0
  121. package/dist/templates/default/convex/errors.ts +33 -0
  122. package/dist/templates/default/convex/functions.ts +54 -0
  123. package/dist/templates/default/convex/http.ts +176 -0
  124. package/dist/templates/default/convex/log.ts +81 -0
  125. package/dist/templates/default/convex/pushTokens.ts +114 -0
  126. package/dist/templates/default/convex/rateLimit.ts +92 -0
  127. package/dist/templates/default/convex/schema.ts +28 -0
  128. package/dist/templates/default/convex/tsconfig.json +18 -0
  129. package/dist/templates/default/convex/users.ts +279 -0
  130. package/dist/templates/default/convex/validators.ts +74 -0
  131. package/dist/templates/default/convex/webhook.ts +193 -0
  132. package/dist/templates/default/convex.json +6 -0
  133. package/dist/templates/default/eas.json +56 -0
  134. package/dist/templates/default/fingerprint.config.js +9 -0
  135. package/dist/templates/default/hooks/use-debounce.ts +20 -0
  136. package/dist/templates/default/hooks/use-deep-link.ts +43 -0
  137. package/dist/templates/default/hooks/use-navigation-tracking.ts +15 -0
  138. package/dist/templates/default/hooks/use-network.ts +11 -0
  139. package/dist/templates/default/hooks/use-notifications.ts +107 -0
  140. package/dist/templates/default/hooks/use-onboarding.ts +15 -0
  141. package/dist/templates/default/hooks/use-reduced-motion.ts +11 -0
  142. package/dist/templates/default/hooks/use-theme.ts +53 -0
  143. package/dist/templates/default/hooks/use-updates.ts +86 -0
  144. package/dist/templates/default/lib/a11y.ts +5 -0
  145. package/dist/templates/default/lib/app.ts +14 -0
  146. package/dist/templates/default/lib/assets.ts +17 -0
  147. package/dist/templates/default/lib/auth-client.ts +21 -0
  148. package/dist/templates/default/lib/convex-auth.tsx +79 -0
  149. package/dist/templates/default/lib/deep-link.ts +71 -0
  150. package/dist/templates/default/lib/dev-menu.ts +119 -0
  151. package/dist/templates/default/lib/device.ts +40 -0
  152. package/dist/templates/default/lib/dynamic-font.ts +49 -0
  153. package/dist/templates/default/lib/env.ts +10 -0
  154. package/dist/templates/default/lib/haptics.ts +24 -0
  155. package/dist/templates/default/lib/notifications.ts +276 -0
  156. package/dist/templates/default/lib/preferences.ts +45 -0
  157. package/dist/templates/default/lib/schemas.ts +137 -0
  158. package/dist/templates/default/lib/storage.ts +47 -0
  159. package/dist/templates/default/lib/updates.ts +107 -0
  160. package/dist/templates/default/metro.config.js +14 -0
  161. package/dist/templates/default/package.json +129 -0
  162. package/dist/templates/default/patches/PR-368.patch +91 -0
  163. package/dist/templates/default/patches/convex-dev-better-auth-0.12.2.tgz +0 -0
  164. package/dist/templates/default/plugins/README.md +9 -0
  165. package/dist/templates/default/plugins/with-auto-signing.js +45 -0
  166. package/dist/templates/default/plugins/with-pod-deployment-target.js +35 -0
  167. package/dist/templates/default/scripts/README.md +36 -0
  168. package/dist/templates/default/scripts/_run.mjs +77 -0
  169. package/dist/templates/default/scripts/clean.ts +543 -0
  170. package/dist/templates/default/scripts/rotate-apple-jwt.mjs +80 -0
  171. package/dist/templates/default/store.config.json +58 -0
  172. package/dist/templates/default/tsconfig.json +13 -0
  173. package/dist/templates/default/vitest.config.ts +21 -0
  174. package/package.json +69 -0
@@ -0,0 +1,618 @@
1
+ # Setup reference
2
+
3
+ Long-form companion to the README. Walks every phase `bunx vexpo full` runs, the prompts you'll see, env-var alternatives for non-interactive runs (CI), recovery paths, and what state ends up where.
4
+
5
+ The orchestrator is the published [`vexpo` CLI](https://www.npmjs.com/package/vexpo) (run via `bunx vexpo lite` (dev) or `bunx vexpo full` (TestFlight-ready)). `package.json` exposes every phase as a `bunx vexpo <phase-name>` shortcut. State lives in `.setup-state.json` (gitignored), `.env.local` (gitignored), Convex deployment env (server-side), and EAS project env (per-environment, with secret-visibility entries powering the JWT rotation cron).
6
+
7
+ ## TL;DR
8
+
9
+ ```bash
10
+ git clone <repo-url> my-app
11
+ cd my-app
12
+ bun install
13
+ bunx vexpo full
14
+ ```
15
+
16
+ Plan ~30 minutes if your accounts already exist, ~60-90 if you're enrolling in the Apple Developer Program for the first time.
17
+
18
+ ## Setup modes
19
+
20
+ vexpo has three entry points:
21
+
22
+ | Mode | Command | When |
23
+ | ----------------- | --------------------- | ---------------------------------------------------------------------------------------------------------------- |
24
+ | Lite (dev) | `bunx vexpo lite` | Greenfield, dev-mode shortcut. Provisions Convex + Better Auth only. ~60 seconds to the iOS Simulator. |
25
+ | Full (TestFlight) | `bunx vexpo full` | Greenfield, production setup. Walks signups, provisions Resend + Apple + EAS, signs JWTs, rebrands. |
26
+ | Env sync | `bunx vexpo env push` | You already have all values in `.env.local` + `.env.prod`: just push them to Convex env and EAS env. No signups. |
27
+
28
+ `bunx vexpo env push` reads `.env.local` (dev) and `.env.prod` or `.env.production` (prod), classifies each key by destination, and pushes to Convex env and EAS env. Per-file confirmation, fingerprint diff on overwrites, no provisioning. Secret-visibility EAS env vars (rotation cron) need `eas env:create --visibility secret` and the command prints the exact invocations when it sees those keys.
29
+
30
+ Pick `env push` when:
31
+
32
+ - Restoring state on a new machine after a wipe.
33
+ - Transferring a working setup to a teammate.
34
+ - Running setup in CI where signups don't make sense.
35
+ - You handled provisioning out-of-band (manual ASC key creation, manual Resend domain setup) and just want to push the resulting values.
36
+
37
+ Pick `lite` for the 60-second simulator path with no Apple Developer account or domain required. Pick `full` for everything you need to ship to TestFlight.
38
+
39
+ ## Dry runs
40
+
41
+ All modes accept `--dry-run`. Print every action the script would take, then exit without touching anything.
42
+
43
+ | Command | Output |
44
+ | ------------------------------- | ----------------------------------------------------------------------------------------------------- |
45
+ | `bunx vexpo full --dry-run` | One block per phase: action (`run`/`skip (cached)`/`run (interactive)`), summary list of what it does |
46
+ | `bunx vexpo env push --dry-run` | Per-source-file plan: every key, every destination, with `create`/`update`/`noop` status + diff |
47
+
48
+ Use it to:
49
+
50
+ - Preview a clone-to-shipping flow before running it on a new machine.
51
+ - Audit what `--force` would re-run before committing to it.
52
+ - Verify in CI that the values in `.env.local` would land in the right places before flipping the switch.
53
+ - Compare what a teammate's `.env.prod` would change vs. yours (run `vexpo env push --dry-run` against their file).
54
+
55
+ `--dry-run` does not hit the network for verification, doesn't prompt for credentials, doesn't write state. It only reads what already exists locally and prints the plan.
56
+
57
+ ## What `bunx vexpo full` does
58
+
59
+ The orchestrator runs the following phases in order, skipping any that are cached fresh in `.setup-state.json`. Each phase is also runnable standalone via `bunx vexpo <phase-name>`.
60
+
61
+ | Phase | Command | Layer | What it does |
62
+ | ----- | --------------------------------------- | ----- | -------------------------------------------------------------------------------------------------------------- |
63
+ | 0 | `bunx vexpo accounts` | meta | Apple Developer / Expo / Convex / Resend signup confirmation |
64
+ | 1 | `bunx vexpo rebrand` | ours | Replace template defaults (interactive, only if forking) |
65
+ | 2 | `bunx vexpo convex` | ours | Provision Convex deployment, write `.env.local` |
66
+ | 3 | `bunx vexpo better-auth` | ours | Generate `BETTER_AUTH_SECRET`, push `SITE_URL`, `APP_NAME` |
67
+ | 4 | `bunx vexpo resend` | ours | Resend sending key + webhook (manual: DNS records at registrar) |
68
+ | 5 | `bunx vexpo review-account` | ours | Seed App Review demo account on Convex |
69
+ | 6 | `bunx vexpo full` (EAS phase) | eas | Thin wrapper: `eas init` + `eas env:push` from `.env.local` |
70
+ | 7 | `bunx vexpo apple asc-key` | ours | Validate ASC API key against ASC `/v1/apps` (no upload) |
71
+ | 7.5 | `bunx vexpo apple credentials` | ours | Wraps `eas credentials -p ios`. Pre-passes cached ASC creds, EAS auto-generates dist cert + profile + push key |
72
+ | 8 | `bunx vexpo apple services-id` | ours | Attach SIWA capability via ASC API (manual: create the Services ID itself) |
73
+ | 9 | `bunx vexpo apple jwt` | ours | Sign SIWA ES256 client_secret JWT, push to Convex env |
74
+ | 10 | `bunx vexpo apple eas-rotation-secrets` | ours | Push the 5 EAS production secrets the JWT rotation cron needs |
75
+
76
+ Phases marked "manual" pause the CLI while you do something a Resend dashboard or Apple Developer portal can't be automated through. The CLI prints exact instructions and waits for you to press Enter.
77
+
78
+ After this, the iOS-platform commands are all `eas-cli`:
79
+
80
+ ```
81
+ eas credentials -p ios # dist cert + provisioning profile + push key + upload ASC API key
82
+ eas build -p ios --profile production
83
+ eas submit -p ios --profile production # auto-creates the App Store record on first run
84
+ ```
85
+
86
+ We don't reinvent any of those, `eas-cli` owns the iOS platform layer end-to-end. The EAS init phase is a thin wrapper that does `eas init` + `eas env:push` because the orchestrator wants one entry point for the env mirror. You can run those two commands directly and skip our wrapper entirely.
87
+
88
+ ## Phase 0: Accounts (`bunx vexpo accounts`)
89
+
90
+ Splits "things you bring" from "things vexpo signs you up for":
91
+
92
+ ### Manual pre-reqs (we don't walk through, just confirm)
93
+
94
+ | Pre-req | Why we don't automate |
95
+ | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
96
+ | Apple Developer ($99/yr) | Apple requires identity verification, payment, signed agreements. 24-48h to verify. Org accounts also need a D-U-N-S number. |
97
+ | Domain + DNS access | Domain registration is per-registrar with payment + WHOIS verification. Any registrar works (Cloudflare, GoDaddy, Route 53, Namecheap, Vercel…). |
98
+
99
+ For both, the script asks "do you have this?" and prints links if you don't. If you say no, the orchestrator continues but downstream Apple/email phases will fail with clear errors when they try to use what's missing.
100
+
101
+ ### Instant signups (we walk you through)
102
+
103
+ | Account | Validation |
104
+ | ------- | ----------------------------------------------------------- |
105
+ | Convex | `~/.convex/config.json` exists after `bunx convex login` |
106
+ | Expo | `bunx eas whoami` returns a username after `bunx eas login` |
107
+ | Resend | `RESEND_FULL_ACCESS_KEY` env probes 200 on `/api-keys` |
108
+
109
+ Each opens the signup page (free-tier accounts, instant), then runs the corresponding CLI login. For Resend, paste a full-access key into the env once: `export RESEND_FULL_ACCESS_KEY=re_...` (the script also prompts interactively if absent). The key is never persisted by vexpo, it's used to provision a scoped sending key + webhook, then forgotten.
110
+
111
+ ### What you'll be prompted for in later phases
112
+
113
+ | Phase | What it needs from you |
114
+ | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
115
+ | `bunx vexpo apple asc-key` | App Store Connect API key (issuer ID, key ID, .p8), created at [appstoreconnect.apple.com/access/integrations/api](https://appstoreconnect.apple.com/access/integrations/api) |
116
+ | `bunx vexpo apple jwt` | Sign In with Apple key (key ID, .p8), created at [developer.apple.com/account/resources/authkeys/list](https://developer.apple.com/account/resources/authkeys/list) |
117
+ | DNS records | Added by you at your registrar after `bunx vexpo resend`. Resend's dashboard shows them and verifies. We don't automate this. |
118
+
119
+ Skip the whole phase: `bunx vexpo full # (accounts walk only runs with --new)`.
120
+
121
+ ## Phase 1: Rebrand (`bunx vexpo rebrand`)
122
+
123
+ Interactive wizard for forks. Detects template defaults like `com.example.vexpo`, `slug: "vexpo"`, `scheme: "vexpo"`. Prompts for:
124
+
125
+ - App name (e.g. "Foobar")
126
+ - Package name (lowercase, hyphenated, e.g. "foobar")
127
+ - Bundle ID (e.g. `com.yourname.foobar`)
128
+ - URL scheme (used for deep links, default = package name)
129
+ - Your name + Expo owner slug (optional, org/team if applicable)
130
+ - Apple review contact email + phone
131
+ - Marketing / support / privacy URLs
132
+ - Copyright owner
133
+
134
+ Edits:
135
+
136
+ - `app.config.ts`, `name`, `slug`, `scheme`, `BUNDLE_ID` env-var fallback
137
+ - `app.json`, clears stale `extra.eas.projectId` (next `eas init` regenerates)
138
+ - `package.json`, `name`, `version` reset to `0.1.0`
139
+ - `store.config.json`, regenerated from example with prompted values
140
+
141
+ Backups land in `.rebrand-backup/<timestamp>/` before any write. Idempotent: re-runs detect "already rebranded" via state and skip unless `--force` is passed.
142
+
143
+ Skip: `bunx vexpo full --skip-rebrand`. Or pre-detect by reading from `.env.local` (`EXPO_PUBLIC_APP_BUNDLE_ID`). If it differs from `com.example.vexpo`, the orchestrator marks the step `cached`.
144
+
145
+ ## Phase 2: Convex (`bunx vexpo convex`)
146
+
147
+ Provisions a fresh Convex deployment (or connects to an existing one). Writes:
148
+
149
+ - `.env.local`: `CONVEX_DEPLOYMENT`, `EXPO_PUBLIC_CONVEX_URL`, `EXPO_PUBLIC_CONVEX_SITE_URL`, `EXPO_PUBLIC_SITE_URL`, `EXPO_PUBLIC_APP_BUNDLE_ID`, `EXPO_PUBLIC_APPLE_TEAM_ID`
150
+ - Convex env: `APP_BUNDLE_ID`, `APPLE_TEAM_ID` (used by `convex/http.ts` to serve `/.well-known/apple-app-site-association`)
151
+
152
+ Prompts for the iOS bundle ID (reverse DNS, e.g. `com.yourname.myapp`) and your 10-character Apple Team ID (in Apple Developer → Membership). Both can be provided non-interactively via `EXPO_PUBLIC_APP_BUNDLE_ID` and `EXPO_PUBLIC_APPLE_TEAM_ID` env vars.
153
+
154
+ `--fresh` wipes `.env.local` and reprovisions a brand new deployment. `--local` runs against `bunx convex dev --local` (self-hosted backend).
155
+
156
+ ## Phase 3: Better Auth (`bunx vexpo better-auth`)
157
+
158
+ Generates a 32-byte base64 `BETTER_AUTH_SECRET`. Sets `SITE_URL`, `APP_NAME` on Convex. No prompts, no env required.
159
+
160
+ If `BETTER_AUTH_SECRET` is already set on Convex, the script preserves it.
161
+
162
+ ## Phase 4: Resend (`bunx vexpo resend`)
163
+
164
+ Prompts once for a Resend full-access key (or reads `RESEND_FULL_ACCESS_KEY`). Picks a verified domain (or the first one if there's only one). Creates:
165
+
166
+ - A scoped sending key named `<pkg.name>` (deletes any existing key with the same name first)
167
+ - A webhook pointing at `<convex-site-url>/resend-webhook`, signed with a fresh secret
168
+
169
+ Sets on Convex: `RESEND_API_KEY`, `RESEND_WEBHOOK_SECRET`, `EMAIL_FROM=<pkg.name>@<domain>`, `RESEND_TEST_MODE=false`.
170
+
171
+ `RESEND_TEST_MODE=true` (default at provision time, flipped to `false` here) sends OTPs to Convex logs instead of real email, useful during local dev. Override `EMAIL_FROM` via `--from`.
172
+
173
+ ### DNS records (you add these yourself)
174
+
175
+ We don't automate DNS. Resend's dashboard at `resend.com/domains/<id>` shows the SPF/DKIM/DMARC records the domain needs and verifies them when you add them at your registrar. Resend has per-provider guides for every common registrar (Cloudflare, GoDaddy, Route 53, Namecheap, Vercel, etc.), pick yours from the dashboard's "Add records" panel.
176
+
177
+ This is the one thing that gates real email sending. Until the domain is verified, every send returns a `validation_error` from Resend.
178
+
179
+ ### Webhook event subscription
180
+
181
+ The webhook subscribes to 9 events: `email.sent`, `email.delivered`, `email.delivery_delayed`, `email.bounced`, `email.complained`, `email.failed`, `email.suppressed`, `email.opened`, `email.clicked`. The 4 actionable failure events (`bounced`, `complained`, `suppressed`, `failed`) tell you when a user's address is dead. `convex/email.ts` logs them with `console.warn` and you extend `handleEmailEvent` to flag the user account if you want to stop retrying. `opened` and `clicked` only fire when per-email tracking is enabled (we don't enable it by default, toggle on individual sends if you want it).
182
+
183
+ `bunx vexpo doctor` confirms the webhook subscription includes all 4 actionable events. If you ever drop one accidentally, re-run `bunx vexpo resend` to refresh.
184
+
185
+ ### Sign In with Apple + Hide My Email (Apple Private Email Relay)
186
+
187
+ If you ship Sign In with Apple (Phases 7-9), users who select "Hide My Email" get an `*@privaterelay.appleid.com` address. Apple proxies email to their real inbox, but Apple won't deliver from sender domains it doesn't trust. You need to register your sending domain at [developer.apple.com](https://developer.apple.com) → Certificates, Identifiers & Profiles → More → "Sign in with Apple for Email Communication" → Configure. Add:
188
+
189
+ - Your sending domain (e.g. `mailer.example.com`)
190
+ - Every from-address you send from (e.g. `vexpo@mailer.example.com`)
191
+
192
+ Resend authenticates via SPF + DKIM by default, which is what Apple wants. So once your domain is verified at Resend AND registered at Apple, Hide My Email users receive OTPs normally. Skip this step and you'll see `email.bounced` events for every relay address, the symptom looks like "Sign In with Apple users never get the verification email".
193
+
194
+ Apple imposes a 100/day limit per relay address, but that's a per-user cap, not a per-app one.
195
+
196
+ ## Phase 5: Review account (`bunx vexpo review-account`)
197
+
198
+ Reads `apple.review.demoUsername` / `demoPassword` from `store.config.json`. Creates the user via Better Auth's signup flow, then flips `emailVerified: true` directly via the adapter so Apple's reviewer doesn't see an OTP prompt.
199
+
200
+ Pass `--email` / `--password` to override the values from `store.config.json`. Same creds you paste into App Store Connect → App Information → App Review → Sign-In Information.
201
+
202
+ ## Phase 6: EAS (auto, no standalone command, runs as part of `vexpo full`)
203
+
204
+ Runs `eas init` (creates the project, or links to an existing one) and writes `extra.eas.projectId` to `app.json`. Mirrors every `EXPO_PUBLIC_*` from `.env.local` to EAS env across `production`, `preview`, and `development` environments using `bunx eas env:create --visibility plaintext`.
205
+
206
+ Pass `--skip-init` to only mirror env, `--skip-env` to only init.
207
+
208
+ After this, `expo prebuild` and `eas build` both find the right project + env. The `extra.eas.projectId` write also enables `app.config.ts → updates.url`.
209
+
210
+ ## Phase 7: ASC API key (`bunx vexpo apple asc-key`)
211
+
212
+ The App Store Connect API key is needed for `eas submit` (and for vexpo's Phase 8 Services ID provisioning). The first key has to be created in the ASC web UI, there's no bootstrap path because you can't authenticate the API without already having a key.
213
+
214
+ Walks you to https://appstoreconnect.apple.com/access/integrations/api, prints step-by-step instructions:
215
+
216
+ 1. Click "Generate API Key" (top-right). Name it (e.g. `vexpo-asc`).
217
+ 2. Set the role to "Admin" or "App Manager" (lower roles can't create bundle IDs).
218
+ 3. Click "Generate". The key cannot be retrieved later, save the .p8 file.
219
+ 4. From the table: copy the Issuer ID (above the table) and the Key ID.
220
+
221
+ Then prompts for issuer ID, key ID, and `.p8` path. Validates by signing an ES256 JWT and calling `GET /v1/apps`. Re-prompts up to 3x with specific error messaging on failure (`401` = bad token, `403` = role insufficient, etc.).
222
+
223
+ Records `{issuerId, keyId, p8Path, validatedAt}` in `.setup-state.json`. The .p8 file itself stays where you put it, vexpo never copies it.
224
+
225
+ Env-var skip: `APPLE_ASC_ISSUER_ID=... APPLE_ASC_KEY_ID=... APPLE_ASC_P8_PATH=/path/to/AuthKey_X.p8 bunx vexpo apple asc-key`.
226
+
227
+ Re-validate cached creds without re-prompting: `bunx vexpo apple asc-key --revalidate`.
228
+
229
+ ## Phase 7.5: EAS iOS credentials (`bunx vexpo apple credentials`)
230
+
231
+ `bunx vexpo apple credentials` wraps the eas-cli wizard. With our env-var pre-passing (`EXPO_ASC_API_KEY_PATH`, `EXPO_ASC_KEY_ID`, `EXPO_ASC_ISSUER_ID`), the wizard skips Apple Developer login entirely. You walk through ~6 Y/n prompts (each "Generate new" or "Use existing"), each takes 1-2 seconds. Apple's API does the actual work server-side.
232
+
233
+ What the wizard sets up:
234
+
235
+ - **iOS distribution certificate** generated via Apple's API
236
+ - **Provisioning profile** linked to the dist cert + your bundle id
237
+ - **APNs push notification key** linked to your bundle id, generated via Apple's API
238
+ - **App Store Connect API key uploaded to EAS** (used for `eas submit`)
239
+
240
+ All credentials are stored encrypted on EAS infrastructure. Subsequent `eas build` + `eas submit` runs are non-interactive.
241
+
242
+ Standalone: `bunx vexpo apple credentials [-e <profile>]`.
243
+
244
+ Bypass entirely: `bunx eas credentials -p ios` runs the wizard directly. The vexpo wrapper just pre-passes the cached ASC creds.
245
+
246
+ ## Phase 8: Sign In with Apple Services ID (`bunx vexpo apple services-id`)
247
+
248
+ The Services ID is a separate `BundleId` resource (with `platform: "SERVICES"`) used by your backend to identify the OAuth client to Apple. EAS doesn't manage these. The regular bundle ID it provisions is for the iOS app itself, not the OAuth backend.
249
+
250
+ **Apple removed the API path that created Services IDs.** `POST /v1/bundleIds` rejects `platform: "SERVICES"` as of 2025. The CLI works around this by detecting existing Services IDs via `GET` and walking you through manual creation in the developer portal if it doesn't exist yet.
251
+
252
+ Reads ASC API creds from state (set by Phase 7) or from `APPLE_ASC_*` env. Reads the bundle ID from `.env.local`. Then:
253
+
254
+ 1. `GET /v1/bundleIds?filter[identifier]=<bundle>`, find the App's primary bundle id resource (any non-SERVICES platform, newer accounts report `UNIVERSAL`).
255
+ 2. `GET /v1/bundleIds?filter[identifier]=<bundle>.signin`, find the Services ID. **If missing**, the CLI prints step-by-step instructions for [the web UI](https://developer.apple.com/account/resources/identifiers/list/serviceId) and waits. After you register it, press Enter and the CLI re-polls.
256
+ 3. `GET /v1/bundleIds/<app>/bundleIdCapabilities`, find the Sign In with Apple capability on the App ID. If absent, create via `POST /v1/bundleIdCapabilities` with `capabilityType: "APPLE_ID_AUTH"`.
257
+ 4. Write `APPLE_SERVICES_ID` to `.env.local`.
258
+
259
+ Default Services ID identifier is `<bundle-id>.signin`. Override via `--services-id` or `APPLE_SERVICES_ID` env.
260
+
261
+ Idempotent: every step is find-only-or-attach. Re-runs do nothing if everything exists.
262
+
263
+ Records resource IDs in state for future audit.
264
+
265
+ ### Manual web UI: creating the Services ID
266
+
267
+ If Phase 8 prompts you to create the Services ID, here's the exact flow:
268
+
269
+ 1. Open [developer.apple.com/account/resources/identifiers/list/serviceId](https://developer.apple.com/account/resources/identifiers/list/serviceId)
270
+ 2. Confirm the dropdown in the top right says **Services IDs** (not "App IDs")
271
+ 3. Click `+`, pick **Services IDs**, Continue
272
+ 4. Description: `<App Name> Sign In` (any string)
273
+ 5. Identifier: the value the CLI told you, typically `<bundle>.signin`
274
+ 6. Continue → Register
275
+ 7. Click into the new Services ID, check **Sign in with Apple**, click Configure
276
+ 8. Primary App ID: your existing App ID (e.g. `com.you.app`)
277
+ 9. Domains and Subdomains: any HTTPS domain you control (Apple may verify ownership)
278
+ 10. Return URLs: any `https://<your-domain>/anything` URL
279
+ 11. Save
280
+
281
+ Apple may ask you to upload an `apple-developer-domain-association.txt` to verify domain ownership. If so, host it at `https://<your-domain>/.well-known/apple-developer-domain-association.txt` (Vercel: drop in `public/.well-known/`). Apple sometimes skips verification for first-time setups. If no upload is requested, you're done.
282
+
283
+ After saving, return to the CLI and press Enter. The CLI re-lists, finds the Services ID, attaches the capability via API, and continues to Phase 9.
284
+
285
+ ## Phase 9: Apple Sign In JWT (`bunx vexpo apple jwt`)
286
+
287
+ Signs an ES256 `client_secret` JWT (180-day expiry, Apple's max) from a Sign In with Apple `.p8` file. Writes:
288
+
289
+ - Convex env: `APPLE_CLIENT_ID` (= Services ID), `APPLE_TEAM_ID`, `APPLE_KEY_ID`, `APPLE_CLIENT_SECRET` (the signed JWT)
290
+
291
+ The `.p8` here is the **Sign In with Apple key**, not the ASC API key. Apple uses `AuthKey_<KEYID>.p8` as the filename for both, they're different keys with different capabilities. Look up the Key ID at https://developer.apple.com/account/resources/authkeys/list to confirm.
292
+
293
+ Prompts:
294
+
295
+ 1. Services ID (read from `.env.local` after Phase 8, or prompted)
296
+ 2. Team ID (10 chars, from Apple Developer → Membership)
297
+ 3. Key ID (10 chars, shown next to the Sign In with Apple key)
298
+ 4. Path to `.p8`
299
+
300
+ Records `{servicesId, teamId, keyId, p8Path, signedAt, expiresAt}` in state.
301
+
302
+ Env-var skip: `APPLE_SERVICES_ID=... APPLE_TEAM_ID=... APPLE_KEY_ID=... APPLE_P8_PATH=/path/to/AuthKey_X.p8 bunx vexpo apple jwt`.
303
+
304
+ Rotate without re-prompting IDs: `bunx vexpo apple jwt --rotate`.
305
+
306
+ ### JWT rotation
307
+
308
+ Apple caps `client_secret` JWTs at 180 days. The `.eas/workflows/rotate-apple-jwt.yml` cron fires every 90 days, signs a fresh JWT, and pushes it to your prod Convex deployment. Runs on EAS infrastructure with all secrets read from EAS env (production, secret visibility), no GitHub repo secrets needed. Set up once, never think about it again. Manual fallback: `bunx vexpo apple jwt --rotate`.
309
+
310
+ ## Phase 10: EAS rotation secrets (`bunx vexpo apple eas-rotation-secrets`)
311
+
312
+ Pushes the 5 EAS production secrets the rotation cron needs. The orchestrator runs this last. It's also a standalone command.
313
+
314
+ | Var | Value source |
315
+ | ---------------------- | ---------------------------------------------------------------- |
316
+ | `APPLE_P8_PRIVATE_KEY` | PEM contents of the SIWA `.p8` (file from Phase 9) |
317
+ | `APPLE_TEAM_ID` | 10-char Apple Team ID (read from `.env.local`) |
318
+ | `APPLE_KEY_ID` | 10-char Sign In with Apple key ID (read from `.env.local`) |
319
+ | `APPLE_SERVICES_ID` | Services ID (read from `.env.local`) |
320
+ | `CONVEX_DEPLOY_KEY` | Convex dashboard → Project → Settings → Deploy keys (production) |
321
+
322
+ The 4 Apple secrets get pulled automatically. `CONVEX_DEPLOY_KEY` is prompted because the CLI can't generate Convex deploy keys, you create it once in the Convex dashboard and paste it back.
323
+
324
+ ```bash
325
+ bunx vexpo apple eas-rotation-secrets # interactive
326
+ bunx vexpo apple eas-rotation-secrets --force # overwrite existing values
327
+ ```
328
+
329
+ If you'd rather run the raw `eas env:create` calls yourself:
330
+
331
+ ```bash
332
+ eas env:create --name APPLE_P8_PRIVATE_KEY --value "$(cat /path/to/SIWA.p8)" --environment production --visibility secret
333
+ eas env:create --name APPLE_TEAM_ID --value <value> --environment production --visibility secret
334
+ eas env:create --name APPLE_KEY_ID --value <value> --environment production --visibility secret
335
+ eas env:create --name APPLE_SERVICES_ID --value <value> --environment production --visibility secret
336
+ eas env:create --name CONVEX_DEPLOY_KEY --value <prod-deploy-key> --environment production --visibility secret
337
+ ```
338
+
339
+ `bunx vexpo doctor --channel prod` lists which of the 5 are present (names appear, values stay opaque since they're secret visibility).
340
+
341
+ ## What `bunx vexpo full` does NOT do
342
+
343
+ These are explicit non-goals, EAS or third parties already handle them well:
344
+
345
+ - **iOS distribution cert / provisioning profile / push notification key (.p8)** are EAS-owned. We wrap the `eas credentials -p ios` wizard via `bunx vexpo apple credentials` so the orchestrator records that it ran, but eas-cli does the work.
346
+ - **iOS bundle ID for the app**, EAS auto-creates on first `eas credentials -p ios` if it doesn't exist.
347
+ - **iOS capability sync**, EAS auto-syncs from `ios.entitlements` (which `app.config.ts` populates from `usesAppleSignIn: true`, `expo-notifications`, `associatedDomains`, etc.) on every `eas build`.
348
+ - **App Store Connect app record**, `eas submit` auto-creates on first run from `app.config.ts → name` + `package.json → name`.
349
+ - **Apple Developer account creation**, manual signup, $99/yr, identity verification, 2FA.
350
+
351
+ ## Lite-mode env sync (`bunx vexpo env push`)
352
+
353
+ ```bash
354
+ bunx vexpo env push # interactive (per-file confirm)
355
+ bunx vexpo env push --force # overwrite without prompting
356
+ bunx vexpo env push --dry-run # show plan, don't apply
357
+ bunx vexpo env push --local-file foo # override .env.local path
358
+ bunx vexpo env push --prod-file foo # override .env.prod path
359
+ ```
360
+
361
+ Lite mode reads source files and pushes values to remote destinations. Zero provisioning, no API calls beyond `convex env set --from-file` and `eas env:push --path`.
362
+
363
+ ### Source files
364
+
365
+ | File | Channel | Default destinations |
366
+ | ----------------- | ------- | ------------------------------------------------------- |
367
+ | `.env.local` | dev | Convex dev env, EAS development env |
368
+ | `.env.prod` | prod | Convex prod env, EAS production+preview, GitHub secrets |
369
+ | `.env.production` | prod | (used if `.env.prod` is absent) |
370
+
371
+ Override paths with `--local-file` / `--prod-file`. Both files are optional, lite mode runs with whatever it finds.
372
+
373
+ ### Routing
374
+
375
+ Each known env-var has a fixed routing in `vexpo`'s env-files module ([source](https://github.com/ramonclaudio/vexpo/blob/main/packages/vexpo/src/lib/env-files.ts)):
376
+
377
+ | Source key | Convex (dev) | Convex (prod) | EAS env | GitHub secret |
378
+ | --------------------------------------- | ----------------- | ----------------- | --------------------- | ------------------------------- |
379
+ | `EXPO_PUBLIC_*` | n/a | n/a | dev (or prod+preview) | n/a |
380
+ | `BETTER_AUTH_SECRET` | dev | prod | n/a | n/a |
381
+ | `RESEND_API_KEY` | dev | prod | n/a | n/a |
382
+ | `RESEND_WEBHOOK_SECRET` | dev | prod | n/a | n/a |
383
+ | `RESEND_TEST_MODE`, `EMAIL_FROM` | dev | prod | n/a | n/a |
384
+ | `APP_NAME`, `SITE_URL`, `APP_BUNDLE_ID` | dev | prod | n/a | n/a |
385
+ | `APPLE_CLIENT_ID` | dev | prod | n/a | n/a |
386
+ | `APPLE_CLIENT_SECRET` | dev | prod | n/a | n/a |
387
+ | `APPLE_TEAM_ID` | dev | prod | n/a | prod only |
388
+ | `APPLE_KEY_ID` | dev | prod | n/a | prod only |
389
+ | `APPLE_SERVICES_ID` | `APPLE_CLIENT_ID` | `APPLE_CLIENT_ID` | n/a | `APPLE_SERVICES_ID` (prod only) |
390
+ | `APPLE_P8_PRIVATE_KEY` | n/a | n/a | n/a | prod only |
391
+ | `CONVEX_DEPLOY_KEY` | n/a | n/a | n/a | prod only |
392
+
393
+ Notes:
394
+
395
+ - `APPLE_SERVICES_ID` is renamed to `APPLE_CLIENT_ID` on Convex (Better Auth's expected key name).
396
+ - GitHub secrets only get pushed from `.env.prod`, they're consumed by the prod-only JWT rotation cron.
397
+ - `CONVEX_DEPLOYMENT` is ignored entirely (file-local pointer used by the Convex CLI, not synced).
398
+ - Anything else is reported as "unrecognized" and skipped.
399
+
400
+ ### Conflict handling
401
+
402
+ For each (key, destination) pair, lite mode classifies the action:
403
+
404
+ | Status | Meaning |
405
+ | --------- | ------------------------------------------------------------------------- |
406
+ | `create` | Destination doesn't have this key. |
407
+ | `update` | Destination has a different value. Prints fingerprint diff (`fp: X → Y`). |
408
+ | `noop` | Destination already has this exact value. |
409
+ | `blocked` | Destination unavailable (no EAS project, etc.). |
410
+
411
+ Per-file confirmation: lite mode prints the full plan, then asks "Apply `<file>` (`<channel>`)?" before each file's writes. Pass `--force` to skip prompts. `--dry-run` prints the plan and exits without writing.
412
+
413
+ Secret-visibility EAS env vars (`APPLE_P8_PRIVATE_KEY`, `CONVEX_DEPLOY_KEY`) aren't routed by lite, `eas env:push --path` doesn't accept a visibility flag, and we won't push secrets at default visibility. If they appear in `.env.prod`, lite prints the exact `eas env:create --visibility secret` commands you need to run instead.
414
+
415
+ ### When NOT to use lite mode
416
+
417
+ - You don't have all the values yet. Lite mode doesn't generate `BETTER_AUTH_SECRET`, doesn't sign Apple JWTs, doesn't create Resend keys. Use full mode for first setup.
418
+ - You haven't run `eas init` yet. Lite mode pushes to EAS env but won't init the project, run full mode or `bunx eas init && bunx eas env:push --path .env.local` once first.
419
+
420
+ ### Example flow
421
+
422
+ Move a working app to a new machine:
423
+
424
+ ```bash
425
+ # On the old machine:
426
+ bunx convex env list > /tmp/dev-env
427
+ bunx convex env list --prod > /tmp/prod-env
428
+ # Edit each into .env.local / .env.prod with the values you want carried over.
429
+
430
+ # On the new machine:
431
+ git clone <repo>
432
+ cd <repo>
433
+ bun install
434
+ bunx vexpo env push # syncs from those files
435
+ bunx eas credentials -p ios # re-uploads cert / profile / keys
436
+ bun run convex:dev
437
+ bun run ios
438
+ ```
439
+
440
+ ## Verification (`bunx vexpo doctor`)
441
+
442
+ ```bash
443
+ bunx vexpo doctor # verify dev (default)
444
+ bunx vexpo doctor --channel prod # verify prod (Convex --prod env)
445
+ bunx vexpo doctor --json # machine-readable output
446
+ bunx vexpo doctor --strict # exit non-zero on warnings
447
+ ```
448
+
449
+ Runs a battery of checks that auth-test each credential and cross-reference the values across `.env.local`, Convex env, EAS env, GitHub secrets, and `app.config.ts`. Lite mode runs the same battery automatically after sync (skip with `--no-verify`). Results are grouped by category:
450
+
451
+ | Category | What's checked |
452
+ | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
453
+ | `files` | `.env.local` / `.env.prod` exist and have the expected `EXPO_PUBLIC_*` keys. |
454
+ | `convex` | Deployment URL reachable. `cloud` and `site` slugs match. `BETTER_AUTH_SECRET` is at least 32 bytes. |
455
+ | `resend` | `RESEND_API_KEY` authenticates. `EMAIL_FROM` domain is in the verified Resend domains. Webhook points at Convex site. |
456
+ | `apple` | JWT decodes. `header.kid === APPLE_KEY_ID`. `payload.iss === APPLE_TEAM_ID`. `payload.sub === APPLE_CLIENT_ID`. `aud` correct. Expiry warns at <30d, fails if expired. ASC API key still authenticates (if cached). Services ID exists in App Store Connect. |
457
+ | `eas` | Project ID present in `app.json`. Signed in. Required `EXPO_PUBLIC_*` env vars mirrored to all three EAS environments. All 5 rotation-cron secrets (`CONVEX_DEPLOY_KEY`, `APPLE_P8_PRIVATE_KEY`, `APPLE_TEAM_ID`, `APPLE_KEY_ID`, `APPLE_SERVICES_ID`) present in production env (names only, values are secret-visibility). |
458
+ | `coherence` | Cross-reference: `EXPO_PUBLIC_APP_BUNDLE_ID === Convex APP_BUNDLE_ID`, team IDs match, Services IDs match, app names match `app.config.ts`. |
459
+
460
+ Each check has a severity:
461
+
462
+ - `ok`, passes.
463
+ - `warn`, works but suspicious (JWT expires in 14d, BETTER_AUTH_SECRET shorter than 32b, EAS not signed in).
464
+ - `fail`, broken (JWT expired, bundle ID mismatch between local and Convex, Resend API key rejected).
465
+ - `skip`, can't be checked (no `.env.prod`, ASC creds not cached, EAS not signed in).
466
+
467
+ Exit status: `0` for ok+warn, `1` if any fail, `1` for warn under `--strict`. Run after every `bunx vexpo env push` to confirm nothing drifted, in CI to catch credential rotation issues, or after a `bunx vexpo apple jwt --rotate` to confirm the new JWT is signed correctly.
468
+
469
+ The check that catches the most real-world bugs: `apple/jwt-iss-matches`. Apple JWTs are easy to sign with the wrong Team ID, happens when you reuse a `.p8` from another project. Verify catches it instantly.
470
+
471
+ ## Iterating: post-setup commands
472
+
473
+ ```bash
474
+ bun run convex:dev # T1: Convex functions
475
+ bun run ios # T2: prebuild + simulator
476
+
477
+ bunx eas build -p ios --profile production # production iOS build
478
+ bunx eas submit -p ios --profile production # auto-creates the App Store record on first run
479
+ bun run eas:tf # build + auto-submit to TestFlight
480
+ bunx eas metadata:push # push store.config.json to App Store Connect
481
+ bunx eas credentials -p ios # manage iOS dist cert / profile / keys
482
+ ```
483
+
484
+ EAS Workflows (`.eas/workflows/`) automate these for you on push to `main`, push tag `v*`, push to `beta/*`, on PR, and on `eas workflow:run`.
485
+
486
+ ## Recovery: rotating things
487
+
488
+ | Thing | Command |
489
+ | -------------------------- | ------------------------------------------------------------------ |
490
+ | Convex deployment | `bunx vexpo full --fresh` |
491
+ | Better Auth secret | `bunx vexpo better-auth --force` |
492
+ | Resend key + webhook | `bunx vexpo resend` |
493
+ | Apple Sign In JWT (manual) | `bunx vexpo apple jwt --rotate` |
494
+ | Apple Sign In JWT (auto) | EAS Workflows → `rotate-apple-jwt` → Run |
495
+ | ASC API key | `bunx vexpo apple asc-key` (re-runs validation) |
496
+ | EAS env mirror | `bunx eas init && bunx eas env:push --path .env.local --skip-init` |
497
+ | EAS rotation secrets | `bunx vexpo apple eas-rotation-secrets --force` |
498
+ | State cache | `trash .setup-state.json` |
499
+
500
+ ## Recovery: things break
501
+
502
+ `.setup-state.json` corrupt or schema mismatch:
503
+
504
+ ```
505
+ trash .setup-state.json
506
+ bunx vexpo full --no-state # full live re-probe
507
+ ```
508
+
509
+ `.env.local` deleted, but Convex deployment still exists:
510
+
511
+ ```
512
+ bunx eas env:pull --environment development # pulls EXPO_PUBLIC_*
513
+ echo "CONVEX_DEPLOYMENT=dev:happy-frog-123" >> .env.local
514
+ ```
515
+
516
+ `bun run ios` fails with provisioning profile errors:
517
+
518
+ ```
519
+ bunx eas credentials -p ios # interactive wizard, regenerate cert/profile
520
+ ```
521
+
522
+ Resend domain unverified or DNS records changed:
523
+
524
+ Open `https://resend.com/domains/<id>`. Resend shows what's missing. Add the records at your registrar, then click Verify in the dashboard. We don't automate this.
525
+
526
+ ASC API key revoked or replaced:
527
+
528
+ ```
529
+ bunx vexpo apple asc-key # validates cached, prompts for new on failure
530
+ bunx eas credentials -p ios # re-upload to EAS
531
+ ```
532
+
533
+ ## CI
534
+
535
+ Use `--no-state` to ignore the local state cache. Provide every interactive value via env. The orchestrator runs in non-TTY mode and skips any step that would prompt without env-var fallbacks.
536
+
537
+ ```yaml
538
+ - run: bun install
539
+ - run: bunx vexpo full --no-state --skip-rebrand
540
+ env:
541
+ EXPO_PUBLIC_APP_BUNDLE_ID: com.yourname.myapp
542
+ EXPO_PUBLIC_APPLE_TEAM_ID: ABCDE12345
543
+ RESEND_FULL_ACCESS_KEY: ${{ secrets.RESEND_FULL_ACCESS_KEY }}
544
+ APPLE_ASC_ISSUER_ID: ${{ secrets.APPLE_ASC_ISSUER_ID }}
545
+ APPLE_ASC_KEY_ID: ${{ secrets.APPLE_ASC_KEY_ID }}
546
+ APPLE_ASC_P8_PATH: /tmp/AuthKey.p8
547
+ APPLE_TEAM_ID: ABCDE12345
548
+ APPLE_KEY_ID: FGHIJ67890
549
+ APPLE_SERVICES_ID: com.yourname.myapp.signin
550
+ APPLE_P8_PATH: /tmp/AuthKey_SIWA.p8
551
+ CONVEX_DEPLOY_KEY: ${{ secrets.CONVEX_DEPLOY_KEY }}
552
+ ```
553
+
554
+ ## Files
555
+
556
+ | Path | Purpose | Source of truth |
557
+ | ----------------------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------- |
558
+ | `.env.local` | Public env (build-time + Convex URL) | written by setup |
559
+ | `.setup-state.json` | Per-step verifyAt cache (gitignored) | written by setup, read by orchestrator |
560
+ | Convex env (`bunx convex env list`) | Server-side secrets | written by setup |
561
+ | EAS env (`bunx eas env:list`) | Build-time env per environment + rotation cron secrets | written by the EAS phase of `vexpo full` + `bunx vexpo apple eas-rotation-secrets` |
562
+ | `app.config.ts` | Expo app config (reads `.env.local`) | edited by rebrand |
563
+ | `app.json` | Static `eas.projectId` | written by `eas init` |
564
+ | `store.config.json` | App Store metadata + review contact | edited by rebrand, gitignored |
565
+ | `package.json` | Project metadata | edited by rebrand |
566
+
567
+ ## State schema
568
+
569
+ `.setup-state.json` v1 layout:
570
+
571
+ ```ts
572
+ type StepRecord = {
573
+ name: StepName;
574
+ completedAt: string; // ISO 8601
575
+ stateVersion: 1;
576
+ scriptVersion?: string;
577
+ outputs?: Record<string, unknown>; // resource IDs, paths, names, never secrets
578
+ verifyAt?: string;
579
+ };
580
+
581
+ type AuditEntry = {
582
+ invokedAt: string;
583
+ args: string[];
584
+ pid: number;
585
+ bunVersion: string;
586
+ cwd: string;
587
+ completed: StepName[];
588
+ skipped: StepName[];
589
+ failed?: { step: StepName; message: string };
590
+ };
591
+
592
+ type SetupState = {
593
+ schemaVersion: 1;
594
+ createdAt: string;
595
+ updatedAt: string;
596
+ lastPid: number;
597
+ steps: Partial<Record<StepName, StepRecord>>;
598
+ audit: AuditEntry[]; // capped at 50 entries
599
+ };
600
+ ```
601
+
602
+ Atomic writes via `tmp + rename`. Schema mismatches fail-loud, `setup` will refuse to run until you `trash .setup-state.json` or upgrade.
603
+
604
+ ## Security
605
+
606
+ | Class | Lives in | Rotates |
607
+ | --------------------- | -------------------------------------------------------------- | --------------------------------------------------------- |
608
+ | `BETTER_AUTH_SECRET` | Convex env | rotate via `bunx vexpo better-auth --force` |
609
+ | Resend sending key | Convex env (`RESEND_API_KEY`) | `bunx vexpo resend` deletes the named key + recreates |
610
+ | Resend webhook secret | Convex env (`RESEND_WEBHOOK_SECRET`) | rotated alongside the key |
611
+ | Apple Sign In JWT | Convex env (`APPLE_CLIENT_SECRET`) | 180-day max, auto-rotated by EAS Workflows cron every 90d |
612
+ | Apple Sign In `.p8` | EAS env `APPLE_P8_PRIVATE_KEY` (secret visibility, production) | rotate the key in Apple Developer Console |
613
+ | ASC API `.p8` | filesystem (path you choose) + state cache | manual, rotate via App Store Connect → Integrations |
614
+ | `CONVEX_DEPLOY_KEY` | EAS env (production, secret visibility) | rotate at Convex Dashboard → Settings → Deploy Keys |
615
+
616
+ `.setup-state.json` only stores resource IDs, file paths, and timestamps, not secrets. Safe to share for debugging.
617
+
618
+ The Resend full-access key is used once to provision a scoped sending key + webhook, then discarded. It's never persisted.