podzooka

Reconnect the mobile app to your Supabase data

The app uses two connections:

  1. Supabase client (apps/mobile/lib/supabase.ts) — auth session, user_history upserts, etc.
    Needs: EXPO_PUBLIC_SUPABASE_URL + EXPO_PUBLIC_SUPABASE_ANON_KEY.

  2. HTTP API (EXPO_PUBLIC_API_URL) — feed, dashboard, explore, podcast pages, playlists list, etc.
    Each request sends Authorization: Bearer <your access token> so the backend can read your rows under RLS.

If either is wrong, or you’re not logged in, you’ll see an empty UI even though data exists in the database.


1. Put the correct project in apps/mobile/.env.local

Create or edit apps/mobile/.env.local (this file is gitignored).

Copy values from Supabase Dashboard → Project Settings → API:

Variable Where to copy
EXPO_PUBLIC_SUPABASE_URL Project URL (e.g. https://xxxx.supabase.co)
EXPO_PUBLIC_SUPABASE_ANON_KEY anon public key (not the service_role key)

Critical: The URL and anon key must be from the same Supabase project where your podcasts, subscriptions, and history actually live. If you created a new project or rotated keys, update both here.

Optional third line depends on how you run the app:

# Local dev API (dev-api-stub on your machine)
EXPO_PUBLIC_API_URL=http://localhost:3000

# OR your deployed site that serves /api/* (production / preview)
# EXPO_PUBLIC_API_URL=https://your-app.vercel.app

For Expo web on the same computer, http://localhost:3000 is fine.
For a physical phone, use your computer’s LAN IP, e.g. http://192.168.1.50:3000, and ensure the dev API is listening on 0.0.0.0 if needed (or use the deployed API URL instead).


2. Local API must see the same Supabase project

If EXPO_PUBLIC_API_URL is http://localhost:3000, run the stub from the repo root so it can load env:

npm run api:dev
# or
npm run dev:mobile-web

scripts/dev-api-stub.mjs reads, in order:

It uses EXPO_PUBLIC_SUPABASE_URL and EXPO_PUBLIC_SUPABASE_ANON_KEY there too. If those are missing, the stub falls back to empty JSON — the app loads but shows no feed/library data.

The dev stub listens on 0.0.0.0:PORT so a phone on Wi‑Fi can use http://YOUR_PC_IP:3000 as EXPO_PUBLIC_API_URL.


2b. Local stub vs deployed web API (“pre-populate from the internet”)

Capability dev-api-stub (this repo) Deployed Next / Vercel API (old apps/web)
Feed, dashboard, explore, podcast detail, subscribe, hide Reads/writes your Supabase Same
Search Uses DB RPCs search_podcasts / search_episodes (only rows already in Postgres) Same pattern if it matched production
Add by RSS URL to fill podcasts + rss_episodes Implemented (requires SUPABASE_SERVICE_ROLE_KEY) Same

So if podcasts is empty in Supabase, Explore and Search stay empty even when everything is “connected.” The pipeline that pulled RSS from the internet lived in the removed web app / workers. Fix: point EXPO_PUBLIC_API_URL at a deployment that still runs that ingestion, or reintroduce those jobs elsewhere, then data appears for the stub’s queries too.


3. Restart Expo with a clean cache

EXPO_PUBLIC_* values are baked in at bundle time.

cd apps/mobile
npx expo start --clear

(Or stop Metro and start again with --clear.)


4. Sign in as the same user as before

Data is tied to auth.users / user_id:


5. Quick sanity checks


6. If you use only the deployed API

Set:

EXPO_PUBLIC_API_URL=https://your-real-deployment.vercel.app

That deployment must implement the same /api/* routes and use the same Supabase project as your .env.local keys. A placeholder or old URL will load the shell but not your data.


Summary checklist