Mobile

Cafe stamp card app: collect 9 stamps, get a free coffee

Phone loyalty app where cafe regulars collect QR-scanned stamps and redeem a free coffee after 9, with row-level security on all customer data.

exporeact-nativetypescriptsupabasepostgresjest

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 cafe-stamp-card-app-collect-9-stamps-get-a-free-coffee-428711
CLAUDE.md
# Cafe stamps

## Purpose

This is a loyalty stamp card app for one neighborhood cafe. Customers use it on iPhone and Android to collect stamps. Staff confirm each stamp at the counter by scanning the customer's card QR code. After 9 stamps, the customer redeems a free coffee, and staff confirm the redemption with a PIN.

## Stack

- Expo SDK (latest) with Expo Router
- TypeScript in strict mode
- Supabase for auth and Postgres
- jest-expo for tests
- ESLint for lint

## Commands

- `npm install`: install dependencies
- `npx expo start`: run the dev server and open in Expo Go
- `npm run typecheck`: TypeScript check
- `npm run lint`: lint the project
- `npm test -- --ci`: run tests once, non-interactive
- `npx expo export --platform web`: smoke build, must succeed before a task is done

## Before you start

- Read SPEC.md before coding any feature. It defines what to build and what is out of scope.
- Read PLAN.md to find the current phase. Tick finished items in PLAN.md.
- Read REVIEW.md before merging a phase.

@REVIEW.md

## Secrets

- Never commit `.env` or real keys.
- Use only placeholders in `.env.example`: `EXPO_PUBLIC_SUPABASE_URL` and `EXPO_PUBLIC_SUPABASE_ANON_KEY`.
- The staff PIN lives in Supabase, never in code or in this repo.

## Data and security rules

- Every new Supabase table must have row-level security (RLS) enabled, with policies in a migration file under `supabase/migrations`.
- Customers can read only their own card and stamps.
- Stamp counts change only through the server function `award_stamp`. Client code never writes stamp counts directly.
- Stamp rules live in one pure function in `src/lib/stamps.ts`: 9 stamps to reward, and a 2-minute cooldown between stamps on one card. Keep unit tests for it passing.

## Gotchas

- Expo Go cannot run some native modules. Check the Expo docs before adding a native library.
- Camera and notification features need permission strings in `app.json` before they work on a device.
- Test on a real phone with Expo Go for camera and QR scanning. Simulators may not have a camera.

## Code conventions

- Keep screens under 200 lines. Split into components when a screen gets larger.
- Use touch targets of at least 44 points.
- Give buttons and QR images accessibility labels.
- Do not log names or emails. Do not show personal data in error messages.
- Add a dependency only when the current phase needs it.

## Working rules

- Work in small steps.
- Run the `verify` skill before saying a task is done.
- Commit after each green step, with a short clear message.
- Use `/clear` between unrelated tasks.
- Use `/effort` to lower thinking for simple tasks and raise it for hard ones.
- Ask before any command that pushes code, submits to a store, or changes the production database.
Use for my project