Mobile

Language exchange video call app with matching

Expo React Native app on Supabase that matches learners across time zones for split-language video calls, with SRS flashcards and freemium quotas.

exporeact-nativetypescriptsupabasepostgresrevenuecat

Built 1 time, downloaded 0 times.

Install from your terminal

Run this in your project folder. It signs you in, shows what changes and asks before it overwrites a file.

npx claude-lab add language-exchange-video-call-app-with-matching-02898e
11 filesDownload zip
CLAUDE.md
# Language exchange app

## Purpose

Two language learners are matched for a 30 minute video call.
Each person's language gets 15 minutes.
Conversation cards suggest topics during the call.
After the call, each user rates the other.
Each pair shares a deck of spaced-repetition (SRS) flashcards.
The free tier allows 3 calls per week.
A subscription removes the limit.

See SPEC.md for product rules and PLAN.md for build phases.

## Stack

- Expo, managed workflow with a dev client.
- TypeScript in strict mode.
- expo-router for navigation.
- Supabase:
  - Postgres, Auth and RLS
  - Edge Functions (Deno)
  - Realtime
  - pg_cron
- Video sits behind an adapter in `src/lib/video/`.
  - The provider is still a placeholder `VIDEO_PROVIDER`, for example LiveKit or Daily.
  - App code imports the adapter, never the provider SDK directly.
- RevenueCat for subscriptions (entitlement `unlimited`).
- expo-notifications for push.

## Commands

- `npx expo start`: dev server (needs the dev client build).
- `npx tsc --noEmit`: type check.
- `npx eslint . --max-warnings 0`: lint.
- `npx jest`: unit tests.
- `supabase start`: local stack (Docker must be running).
- `supabase db reset`: rebuild the local DB from migrations and seed.
- `supabase test db`: pgTAP tests in `supabase/tests/`.
- `deno test supabase/functions`: Edge Function tests.
- `supabase gen types typescript --local > src/types/db.ts`: regenerate DB types.

## Architecture rules

### Time

- Store every time as `timestamptz` in UTC.
- Store availability as weekly rules: an IANA time zone name plus a local start and end time.
- The server expands those rules into UTC `tstzrange` slots.
- Never compute matches in the client.
- Use date-fns-tz only to display times.

### Security

- Every new table gets RLS enabled in the same migration.
- Every new table also gets a pgTAP test in `supabase/tests/`.
- Never use the service role key in the app.

### Business logic

- Business rules live in Postgres functions or Edge Functions:
  - quota check
  - matching
  - no-show penalty
  - report handling
- The client only calls these functions.

### Contact details

- Profile text fields must not contain contact details:
  - emails, phone numbers, URLs, @handles
  - the words whatsapp, telegram, insta
- Check for them in two places:
  - a DB trigger, which is the source of truth
  - the client, for faster feedback (`src/lib/contactFilter.ts`)

### Blocking

- Blocked users are excluded from matching, chat, flashcard sharing and search.
- Every such query uses one SQL helper: `is_blocked(a, b)`, which checks both directions.

### Call timer

- The server anchors the call timer.
- Each call has a `started_at` value.
- The two halves are derived from `started_at` + 15 min.
- This way both phones switch language at the same moment, even if their clocks drift.

## Gotchas

- DST changes shift weekly availability.
  - Test with Europe/London and America/New_York around the March and November transitions.
- Some zones have half-hour offsets (Asia/Kolkata is +5:30).
- Regenerate the DB types after every migration.
- Push notifications need a physical device or a dev build. They do not work in a simulator or in Expo Go.

## Secrets

- Never commit `.env`.
- Use placeholder keys:
  - `SUPABASE_ANON_KEY`
  - `REVENUECAT_API_KEY`
  - `VIDEO_API_KEY`
  - `VIDEO_API_SECRET`
- `VIDEO_API_SECRET` lives only in the Edge Function environment.
  - It is set with `supabase secrets set`.
  - It never goes in app code or in `EXPO_PUBLIC_` variables.

## Workflow

1. Explore first, then plan, then write code.
2. Run the `verify` skill before saying a task is done.
3. Delegate long test output to the `test-runner` subagent.
4. For changes to migrations, Edge Functions, safety features or payments, run the `security-reviewer` agent before finishing.
5. Follow the `db-change` skill for migrations.
6. Follow the `timezone-matching` skill for availability and matching work.

## Review checklist

@REVIEW.md
Use for my project