Skip to content

Data model and app structure

Defined in supabase/migrations/0001_init.sql. Every table has row level security; there is no policy that lets a user see a row that is not theirs or their partner’s.

Table Purpose Plaintext user content?
profiles one per verified phone: display name, public key display name only
pairs exactly two profiles, both public keys, started/ended timestamps; a person may hold up to 12 active pairs, one per couple no
invites hash of a pairing code, expiry, who accepted it no
messages id, pair, sender, kind, sender timestamp, encrypted body no
cooling_off per couple: when they may pair again, whether the wait was skipped no
entitlements one per person: Plus plan, source, expiry, receipt reference no
gifts hash of a gift code, buyer, card message, redemption card message only
linked_devices web sessions the phone has approved, with the pair key wrapped for them no

Everything that crosses the string is a WireMessage with a kind. The kind is visible to the relay (it is in the authenticated header) so the app can filter without decrypting; the body is not.

Kind Body Notes
chat { text, replyTo? } one bubble
nudge { emoji } a single emoji, large, with haptics on phones
list { listId, title, items[] } sent whole on every change; latest ts per listId wins
plan { planId, title, start?, end?, notes, stops[] } same last-write-wins approach
sealed { salt, nonce, ct, hint?, openAt? } a SealedEnvelope inside the normal envelope
system { event } paired, unpaired, key-rotated; inserted by the relay, empty ciphertext

Last-write-wins is deliberate: with two people editing a short list, conflicts are rare and a CRDT is not worth the complexity yet. If it becomes a problem, item-level operations are the next step, not a new storage model.

apps/app/src
app/ Expo Router routes
_layout.tsx boots the store, redirects by phase
verify.tsx phone + OTP
name.tsx display name
strings.tsx the switchboard: one row per string, cooling-off periods
plus.tsx Filocan Plus: shown when a free account adds a second string; gift codes
pair.tsx show / scan QR (a detour from strings or the Us tab)
(paired)/ tab navigator for the active string
index.tsx chat ('String')
lists.tsx
plans.tsx
sealed.tsx
us.tsx safety string, how it works, the scissors
store/index.ts one zustand store: phase, identity, pair, messages
lib/relay.ts Relay interface; SupabaseRelay and DemoRelay
lib/keystore.ts secure store on phones, localStorage on web
lib/supabase.ts client; DEMO_MODE when no env is set
components/ui.tsx Screen, Button, Input, Card, ...
theme/ tokens from the brand

Phases. The store has one phase: loading, verify, name, strings, paired. The root layout redirects to the matching route whenever it changes, popping back to a screen already in the stack rather than stacking a copy. The one exception is /pair, which is pushed as a detour and dismisses itself when the string is tied.

Demo mode. With no EXPO_PUBLIC_SUPABASE_URL, relay is a DemoRelay with three in-memory partners (Sam, Mum, Jo) who accept invites in turn after four seconds, seed their own conversations, and reply to chat. Every message still goes through real encryption. The marketing site’s screenshots are rendered from this mode by apps/www/scripts/screenshots.mjs.