On this page
Long distance is mostly small signals: a tap that says I am thinking of you, seen on the other person's home screen a moment later. This brief describes a tiny private app for exactly two people. Widgets make it feel alive on both platforms, with Android first through Jetpack Glance and iPhone through WidgetKit (iPhone builds need a Mac with Xcode). Because two phones must see the same moment, it needs a small backend: connect your own Supabase. The first release proves one loop: pair two phones with a code, send a tap from one, and see it appear in the other app and its widget.
Screens
- Pair: Create a six-character invite code or enter the one your partner shared
- Home: One big thinking-of-you button, the last tap you received and when it arrived
- Moments: A private timeline of taps and short notes between the two of you
- Widget setup: Explain how to place the widget that shows your partner's latest tap
- Settings: Change your display name, mute for a while or unpair and delete shared history
Data model
| Table | Key fields | Purpose |
|---|---|---|
| couples | id (uuid), created_at (timestamptz), ended_at (timestamptz nullable) | One private pair; ending it stops all further sharing |
| couple_members | couple_id (uuid), user_id (uuid), display_name (text) | Exactly two authenticated people per couple |
| invites | code (text), couple_id (uuid), expires_at (timestamptz), used_at (timestamptz nullable) | A single-use pairing code that expires after a short window |
| taps | id (uuid), couple_id (uuid), sender_id (uuid), kind (text), note (text), sent_at (timestamptz) | Each thinking-of-you signal, readable only inside its couple |
Row-level security carries this whole app. A person may read couples, members and taps only where they appear in couple_members, and may insert a tap only as themselves into their own couple. Redeem invites through a server function that checks expiry, single use and a two-member limit in one transaction, so a leaked code cannot add a third person. Unpairing should set ended_at, remove both members' access and offer to delete the tap history, rather than quietly leaving private notes readable.
Native features
Delivery is honest about its limits. This brief does not use remote push, which needs separate developer accounts and certificates. While the app is open it listens on Supabase Realtime; when closed, the widget refreshes on the system's schedule and on the next app launch, so a tap may show a little later.
| Feature | Android (Kotlin) | iPhone (SwiftUI) | Notes |
|---|---|---|---|
| Partner widget | Jetpack Glance widget reading the last cached tap | WidgetKit widget in an App Group | The widget shows the newest tap the app has fetched; it never invents a fresh one. |
| Live updates in app | Supabase Realtime channel in a ViewModel | Supabase Realtime subscription in an observable model | Subscribe only to the signed-in couple's taps, and unsubscribe when the screen leaves. |
| Send feedback | Vibration with a short HapticFeedbackConstants pulse | sensoryFeedback on the send button | A gentle buzz confirms the tap was saved by the server, not just pressed. |
Android notes (Kotlin and Jetpack Compose)
Keep the Home screen to one large Material 3 button and a card for the last received tap. A ViewModel owns the Realtime subscription and writes each new tap into a small Room cache that the Glance widget reads.
- Disable the button while a send is in flight and pass a client-generated tap ID so a double press or retry cannot store two taps. Show a calm offline message instead of pretending the tap was delivered.
- After a tap arrives or the app resumes, call GlanceAppWidget.updateAll. Use a periodic WorkManager job as a modest background refresh, accepting that the system decides the exact timing.
- On two Android phones, pair with a fresh code, then try the same code on a third phone and confirm it is refused. Send a tap with the receiver's app open and closed, and note how long the widget takes in each case.
iPhone notes (Swift and SwiftUI)
Use a simple TabView with Home and Moments, and present pairing as a full-screen cover until the person belongs to a couple. Store the session with the Supabase Swift client and keep the last received tap in an App Group so the widget extension can read it.
- Generate a fresh WidgetKit timeline whenever the app receives a tap, then call WidgetCenter.shared.reloadTimelines(ofKind:). Show the partner's display name and a relative time such as 5 min ago.
- Use Dynamic Type for notes in Moments and limit notes to a short length on both client and server. Offer a mute toggle that hides the widget content without unpairing.
- On an iPhone paired with an Android phone, send a note, unpair from Settings and confirm the partner can no longer load Moments. Try an expired invite code and check the error explains how to get a new one.
Copy-paste prompt
Make a little app for me and my long-distance girlfriend: I tap thinking of you and it shows up on her home-screen widget. Build it as a native Android app for exactly two people. Screens: Pair, Home, Moments, Widget setup and Settings. Use my own Supabase for sign-in and data, and ask me to connect it before writing any backend code. Pair with a six-character single-use invite code that expires after 15 minutes and never allows a third member. Store couples, members, invites and taps, and lock every table with row-level security so only the two members can read their history. Update the app live with Realtime while it is open and refresh the widget from the latest saved tap. Do not use remote push notifications or claim instant delivery when the app is closed. Include offline, expired code and unpaired states, a mute option and an unpair button that can delete our shared history. For acceptance, pair two phones, send a tap and show it on the partner's widget.
Opens Apirex with this prompt in the box. Pick the Android · Kotlin tab before you send.
Acceptance test
- Create an invite on phone A, redeem it on phone B, and confirm both show the same couple and each other's display name.
- Try the used code on a third account and wait out a second code's expiry; both attempts must be refused with a clear message.
- Send a tap from A while B's app is open, and verify it appears once in B's Home and Moments within a few seconds.
- Close B's app, send another tap, then check B's widget after a system refresh or after opening the app, and confirm the time shown is the real send time.
- Unpair from B and choose to delete history; confirm A can no longer read past taps and a direct query for that couple's rows returns nothing.
Test the privacy rules directly, not only through the screens. Sign in as an unrelated account and query taps by a guessed couple ID; the database should return nothing. Turn off the network on A, press the button and confirm the app explains the tap has not been sent, then reconnect and make sure exactly one tap goes through.
Frequently asked questions
Will my partner get a notification instantly?
This brief deliberately avoids remote push. The tap appears live when their app is open and on the widget when the system refreshes it or the app next opens. Push can be added later with the proper developer accounts.
Who can see our notes?
Only the two people in the couple, enforced by row-level security in your own Supabase project. Nobody else's account can read them, and unpairing can remove the shared history entirely.
Can it work between an Android phone and an iPhone?
Yes, as long as both apps point at the same Supabase project and share the same table design. Each platform draws its own widget from the same saved taps.
Build this blueprint
The blueprint prompt, ready for your platform. Edit anything before you send it.
Opens Apirex with this prompt. Pick the Android · Kotlin tab before you send. The Free plan includes 5 Rex Credits a day.