PinPoint now uses:
- an Expo / React Native frontend in
mobile/for iPhone, Android, and web - a Next.js app at the repo root for
/apiroutes and server-side backend logic - Supabase for auth, Postgres, and storage
- a Cloud Run worker for scoreboard processing
The old separate Next web UI has been retired. Browser users now run the same Expo frontend route tree as mobile.
mobile/: canonical product frontend for native and webapp/api/: Next.js API routes and backend helpersdb/: schema and SQL migrationsworker/: Cloud Run image-processing workerscripts/sync-expo-web.mjs: exports the Expo web app into the root static assets for Next/Vercel hosting
Root .env.local should include:
SUPABASE_URL=
SUPABASE_SERVICE_ROLE_KEY=
SUPABASE_STORAGE_BUCKET=
EXPO_PUBLIC_SUPABASE_URL=
EXPO_PUBLIC_SUPABASE_ANON_KEY=
EXPO_PUBLIC_API_BASE_URL=
GEMINI_API_KEY=
WORKER_AUTH_TOKEN=
GEMINI_MODEL=
DEV_USER_ID=
CHAT_DEBUG=
CHAT_MODE=
CHAT_SHOW_METHOD=
CHAT_SHOW_TIMING=
WORKER_URL=
CHAT_THINKING_MODE=
WORKER_THINKING_MODE=
API_CORS_ALLOWED_ORIGINS=Notes:
EXPO_PUBLIC_*values are now the browser/mobile frontend source of truth.- For the deployed web app,
EXPO_PUBLIC_API_BASE_URLcan be omitted if you want browser requests to use same-origin/apivia runtime origin detection. - Native dev-client flows in
mobile/can still usemobile/.env.local/ EAS env pulls.
From the repo root:
npm install
npm run devThis will:
- export the Expo web frontend from
mobile/ - copy it into the root static assets
- start
next dev
Open:
http://localhost:3000
From the repo root:
npm run dev:expo-webThis uses Expo’s web dev server instead of the production-like Next-hosted path.
From mobile/:
npm install
npx eas login
npx eas init
npm run env:pull:preview
npm run build:android:development
npm run start:dev-clientFrom mobile/:
npm run env:pull:production
npm run build:android:productionThis creates a production Android App Bundle (.aab) for the Play Store using the PinPoint production app identity (com.alonl.pinpoint).
From the repo root:
npm run buildThe root build now:
- exports the Expo web frontend
- syncs it into the root static assets
- builds the Next backend/API app
In production, one Vercel deployment serves:
- Expo web for browser routes like
/sessions,/chat,/record/live,/games/[gameId] - Next API routes under
/api/**
The frontend source of truth is mobile/src/.
That codebase provides:
- Expo Router routes
- shared UI/components
- Supabase auth/session handling
- browser/mobile calls into the Next API backend
The root Next app now exists for:
/api/**- auth-aware backend logic
- business rules and orchestration
- hosting the exported Expo web frontend in the same deployment
The worker:
- claims queued jobs
- downloads uploaded scoreboards from Storage
- calls Gemini
- writes frames/shots/results back to Postgres
GET /api/game?gameId=...GET /api/gamesPATCH /api/gamePATCH /api/game/sessionPOST /api/chatPOST /api/friends/inviteGET /api/friends/leaderboardPOST /api/auth/claim-guestGET /api/record-entry-statusGET/PATCH /api/live-sessionPOST /api/live-session/capturePATCH/DELETE /api/live-session/gamePOST /api/live-session/endGET/DELETE /api/recording-draftPOST /api/recording-draft/uploadPATCH/DELETE /api/recording-draft/gamePATCH/DELETE /api/recording-draft/group
- Run
db/schema.sql - Run any needed migration files in
db/ - Create a Storage bucket named
scoreboards-tempor setSUPABASE_STORAGE_BUCKET - Enable Email auth in Supabase Auth
Recommended Storage insert policy:
create policy "users upload into own folder"
on storage.objects
for insert
to authenticated
with check (
bucket_id = 'scoreboards-temp'
and split_part(name, '/', 1) = auth.uid()::text
);This worker claims a queued job, downloads the image from Supabase Storage, calls Gemini, stores frames/shots, and deletes the image.
Run the current DB schema and migrations before redeploying the worker if backend structures changed.