Update expo app to make it somewhat functional

This commit is contained in:
2026-03-26 12:36:18 -05:00
parent 56fe2a2af3
commit ff8c39dc75
18 changed files with 15732 additions and 7478 deletions

View File

@@ -1247,29 +1247,45 @@ See the 4-step checklist in [Section 5](#5-environment-variables--complete-refer
---
## 14. Expo App — Known Issues, Do Not Touch
## 14. Expo App — Scaffold Only, Not Production-Ready
The `apps/expo/` directory exists as a placeholder for future mobile development.
It is currently non-functional — it still contains the original T3 Turbo template
code and has not been migrated to use Convex or `@convex-dev/auth`.
The broken T3 Turbo template code has been cleaned up — all `@acme/*` references,
tRPC, and `better-auth` have been removed and replaced with the correct Convex patterns.
The app will now load, but it is still a bare scaffold with no real features.
**Do not work on the Expo app unless explicitly asked.** If you are asked to work on it,
be aware that the following are all broken and will need to be addressed:
### Current state
| File | Issue |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------ |
| `src/utils/api.tsx` | Imports `AppRouter` from `@acme/api` — package does not exist. Uses tRPC, which is not used anywhere in this repo. |
| `src/utils/auth.ts` | Uses `better-auth` / `@better-auth/expo` instead of `@convex-dev/auth` |
| `src/app/index.tsx` | Old T3 Turbo template code using tRPC mutations and better-auth session patterns |
| `src/app/post/[id].tsx` | Same — tRPC and better-auth patterns throughout |
| `postcss.config.js` | References `@acme/tailwind-config` — package does not exist |
| `src/styles.css` | Imports from `@acme/tailwind-config` — package does not exist |
| `eslint.config.mts` | Imports from `@acme/eslint-config` — package does not exist |
| `eas.json` | Specifies `pnpm 9.15.4` as the package manager — should be bun |
The app is wired up with the correct providers and patterns:
When the time comes to properly implement the Expo app, the right approach is to start
fresh with Convex + `@convex-dev/auth` patterns (mirroring how the Next.js app works),
not to try to incrementally fix the broken T3 Turbo code.
- **`src/app/_layout.tsx`** — `ConvexAuthProvider` wraps the root, initialized with
a `ConvexReactClient` pointed at the self-hosted backend
- **`src/utils/convex.ts`** — Convex client setup, derives the backend URL from the
Expo dev server host in development; reads from `app.config.ts` `extra.convexUrl`
in production
- **`src/app/index.tsx`** — A minimal home screen that reads auth state via
`useConvexAuth()` and queries the current user via `api.auth.getUser`
- **`src/app/post/[id].tsx`** — A placeholder detail screen (route structure kept intact)
- **`src/utils/session-store.ts`** — `expo-secure-store` helpers for token storage
- **`src/utils/base-url.ts`** — Dev server localhost detection
### What still needs to be built
- Sign-in / sign-up screens (mirror the Next.js `(auth)/sign-in` flow, adapted for RN)
- Authenticated navigation / route protection (check `isAuthenticated` in layout)
- Any actual app screens and Convex queries for your specific project
### Production URL configuration
For production builds, set `convexUrl` in `app.config.ts` `extra`:
```typescript
extra: {
convexUrl: 'https://api.convex.example.com',
},
```
The client in `src/utils/convex.ts` will prefer this over the dev-server-derived URL.
---
@@ -1290,16 +1306,7 @@ native fix for this or if a custom update script is needed.
---
**2. Password validation mismatch** ✅ Fixed
`validatePassword()` in `packages/backend/convex/custom/auth/providers/password.ts`
now fully matches `PASSWORD_REGEX` in `packages/backend/types/auth.ts`. Both enforce:
minimum 8 characters, maximum 100, no whitespace, at least one digit, one lowercase
letter, one uppercase letter, and at least one special character (`[\p{P}\p{S}]`).
---
**3. Root `.dockerignore` includes `.env` in build context** Known, works intentionally
**2. Root `.dockerignore` includes `.env` in build context** Known, works intentionally
The root `.dockerignore` has `.env` commented out, meaning the `.env` file is sent to
the Docker build context. This is how build-time env vars (Sentry token, `NEXT_PUBLIC_*`)
@@ -1307,12 +1314,9 @@ reach the Next.js build step. It's a known imperfect approach but fully function
A proper solution would use Docker build args (`ARG`) or multi-stage secrets, but this
requires careful restructuring to avoid breaking Sentry source map uploads.
The redundant `docker/.dockerignore` has been deleted — it was never read by Docker
since the build context is always the repo root.
---
**4. In-memory IP banning resets on restart** Future enhancement
**3. In-memory IP banning resets on restart** Future enhancement
`src/lib/proxy/ban-sus-ips.ts` stores bans in a JavaScript `Map`. Bans reset whenever
the Next.js server restarts (container restart, redeploy, etc.). A more robust solution
@@ -1321,7 +1325,7 @@ job) or to Redis.
---
**5. `apps/next/src/lib/metadata.ts` has hardcoded branding** ⚠️ Template concern
**4. `apps/next/src/lib/metadata.ts` has hardcoded branding** ⚠️ Template concern
When using this as a template for a new project, `metadata.ts` must be updated:
the title template (`'%s | Convex Monorepo'`) and any other project-specific strings.
@@ -1329,7 +1333,7 @@ Same for `next.config.js` `images.remotePatterns` (currently `*.gbrown.org`).
---
**6. No CI/CD** Future enhancement
**5. No CI/CD** Future enhancement
There is no `.github/workflows/` directory. All deployment is done manually via SSH.
A future enhancement would add GitHub Actions (or Gitea Actions, since this repo is
@@ -1337,7 +1341,7 @@ on Gitea) for automated lint and typecheck on pull requests.
---
**7. Scripts organization** Future exploration
**6. Scripts organization** Future exploration
Currently:
@@ -1351,14 +1355,7 @@ moving everything to `docker/scripts/`.
---
**8. Expo `eas.json` specifies pnpm** Low priority (Expo is WIP anyway)
`apps/expo/eas.json` specifies `pnpm 9.15.4` as the package manager. Should specify
bun. This is low priority since the Expo app is not in active development.
---
**9. React Email templates not yet implemented** Future enhancement
**7. React Email templates not yet implemented** Future enhancement
`@react-email/components` and `react-email` are in `packages/backend/package.json` as
planned dependencies. The current `usesend.ts` uses inline HTML strings for email