On this page
A shared grocery list helps household members agree on what still needs buying while standing in different aisles. The useful first release is not a product catalog: it is a small shared workspace with predictable edits and revocable access. This brief focuses on inviting one other person, adding and checking items, and ensuring that an invitation never becomes public access to every household list.
Screens
- Lists: show only personal lists and lists the current account has joined.
- List detail: display quantities and checked state, including pending changes that are not yet synchronized.
- Add item: capture a name, quantity and optional unit without requiring a store catalog.
- Shared with: list current members and let an authorized owner invite or remove participants.
Data model
| Table | Key fields | Purpose |
|---|---|---|
| lists | id (uuid), owner_id (uuid), title (text), created_at (timestamptz) | The household shopping workspace and its accountable owner. |
| items | id (uuid), list_id (uuid), name (text), quantity (decimal), unit (text?), checked (bool), version (int) | Individually editable purchases with conflict-detection versions. |
| memberships | list_id (uuid), user_id (uuid), role (text), joined_at (timestamptz) | Explicit owner and editor access for a single list. |
| invitations | id (uuid), list_id (uuid), token_hash (text), expires_at (timestamptz), revoked_at (timestamptz?) | Revocable invitations that never store a usable token in public list data. |
Enforce membership on the server with row-level security for list reads, item edits and membership changes. A guessed list ID or shared URL must not grant access by itself: exchange a valid, unexpired invitation for explicit membership after authentication. Let only the owner invite or remove members unless another role is deliberately defined. For private single-device shopping, local-only storage is an alternative that omits invitations entirely. Shared offline edits need an owner-approved conflict rule; do not describe a locally checked item as synchronized before acknowledgement.
Keep pantry preferences and optional notes out of invitation previews. When an owner removes a household member, explain that previously viewed information cannot be recalled from their memory or screenshots, while all future server reads and edits must be denied.
Native features
Shared groceries depend on quick aisle checking, offline item edits and a controlled invitation handoff. Room on Android or SwiftData on iPhone can hold item versions plus pending changes while the shop has poor signal. That local cache must not label an edit shared until the backend acknowledges it. Send a server-issued invitation through ACTION_SEND or ShareLink; do not expose a raw membership token in item records. A checked item should remain recognizable after sorting so one-handed shopping does not lead to checking the next row by mistake.
Android notes (Kotlin and Jetpack Compose)
Use a LazyColumn keyed by item UUID, with Material 3 checkboxes and an accessible quantity label that includes units. Keep aisle order separate from the checked flag; moving purchased items must not change their identities. Room should store an outbox entry with the expected item version, and WorkManager can retry that entry when connectivity returns. Offer quantity correction in a ModalBottomSheet rather than treating a tap on the whole row as both edit and check. In a supermarket device test, disable connectivity, check milk, and change its quantity from another shopper's phone. Reconnect and show the agreed conflict rule without losing either pending intent silently.
iPhone notes (Swift and SwiftUI)
Build the household workspace with NavigationStack and a List whose row IDs survive filtering out purchased items. SwiftData can retain pending checks, but a separate sync state should tell the shopper when the other household member can see them. Present quantity and unit edits in a short sheet, and use ShareLink only after an expiring invitation exists. Add .refreshable for a deliberate membership and item refresh. On an iPhone, increase text size, check neighboring rows quickly, then terminate before synchronization completes. Reopen and reconcile the same item IDs; a revoked household invitation must not restore access to the shopping list.
Copy-paste prompt
Build a shared grocery list app for Android with Lists, List detail, Add item and Shared with. Use lists, items, memberships and expiring revocable invitations. Ask whether I want private local lists or authenticated household sharing; do not upload a local list without that decision. For sharing, enforce membership and owner roles on the backend with row-level security. Store invitation token hashes, validate expiry on the server and require redemption into an account. Ask how simultaneous quantity edits, checked items, duplicate names and owner departure should work. Include loading, no lists, empty list, offline pending changes, conflict, expired invite and revoked access states. Acceptance means a second account joins one list, both accounts see an added item and its checked state after reopening, and an unrelated or removed account cannot read it through a copied URL.
Opens Apirex with this prompt in the box. Pick the Android · Kotlin tab before you send.
Acceptance test
- Create a list called Weekend shop, add rice with quantity 2 and unit kg, then issue an invitation with a defined expiration.
- Redeem the invitation using a second account and add apples; verify both authorized accounts receive the item through the actual backend.
- Check rice on the second device, reopen the first app and verify the persisted checked state and quantity are consistent.
- Revoke the second account’s membership and attempt a direct read and item update using its old session; require server denial.
- Try an expired invite from a third account and edit an item while offline; show expiry and pending-change states without falsely reporting successful sharing.
Frequently asked questions
Does the share sheet make a list public?
It should share a limited invitation, not an unrestricted database URL. The server still verifies token expiry and account membership, and the invite should expose no unrelated list titles or household members.
What happens if two shoppers change the same quantity?
Choose a policy before implementation, such as rejecting an update whose expected version is stale and asking the shopper to reconcile it. Blindly accepting whichever cached list arrives last can erase another person’s changes.
Can a child join a household list?
Do not assume an adult household invitation is sufficient consent for a child’s account. If children will use the service, define age, guardian, retention and access requirements with appropriate privacy review before collecting their data.
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.