Family & Friends Sharing

Family & Friends Sharing in SparkyFitness allows you to connect with family members, friends, personal trainers, or coaches. By granting specific access permissions, you can allow others to log meals, track workouts, record check-ins, manage medications, or view progress reports on your behalf.

The system is built with least-privilege boundary isolation using PostgreSQL Row-Level Security (RLS), ensuring that your private credentials and account settings are never shared.


How to Set Up Sharing

Setting up a connection is simple and can be managed directly from the application settings:

  1. Go to Settings: Navigate to Settings -> Family Access Manager in the application sidebar.
  2. Add a Connection:
    • Enter the email address of the family member or friend you want to connect with.
    • Choose the specific permissions you want to grant them (see the matrix below).
    • Optional: Set an Access End Date if you want the permission to expire automatically.
  3. Save Connection: Click Add Connection. The new connection will appear under "Rules I Created".
  4. Accessing Switched Profiles: The connected person will now see your profile in their Profile Switcher (located in the top-right corner of the dashboard). They can select your name to switch contexts and act on your behalf.

Privilege Matrix by Permission Level

SparkyFitness uses 7 granular permissions to determine exactly what a connected user can read or write in your profile:

Access PermissionWrite (Create / Edit / Delete) PrivilegesRead (View) Privileges
Manage Diary
can_manage_diary
โœ๏ธ Food entries, exercise entries, water logs, daily goal plans, favorite (starred) foods/meals.๐Ÿ“– Food entries, exercise entries, water logs, daily goal plans, favorite (starred) foods/meals, custom food/exercise libraries, and read-only profile/layout/water-container settings.

โŒ Wellness logs (fasting, sleep, mood) and medication logs are completely blocked.
Manage Check-in
can_manage_checkin
โœ๏ธ Weight, body measurements, progress photos, mood logs, fasting status, sleep logs, and custom measurement categories/values (e.g. GLP-1 daily check-in).๐Ÿ“– Weight history, progress photos, wellness logs (mood, fasting, sleep), custom measurements, and read-only profile/layout settings.

โŒ Diary logs (food, exercise, water) and medication logs are completely blocked.
Manage Medications
can_manage_medications
โœ๏ธ Medication schedules, pen/vial allocations, injection records, titration adjustments, and daily symptom logs.๐Ÿ“– Medication lists, schedules, logs, pens, injection sites, titration steps, and symptom entries.

โŒ Diary logs (food, exercise, water) and check-in logs (weight, sleep, fasting) are completely blocked.
View Reports
can_view_reports
โŒ No write privileges๐Ÿ“– All wellness, check-in, diary, and medication logs to display on charts, graphs, and the dashboard. Also includes read-only access to profile, dashboard layout, and onboarding data.
View Food Library
can_view_food_library
โŒ No write privileges๐Ÿ“– User's custom food list, recipes, and custom meals โ€” including any reusable sub-meals a meal links as ingredients โ€” (isolated to when context is switched).

โŒ Profile, dashboard layout, and onboarding data are not readable โ€” this permission alone is insufficient.
View Exercise Library
can_view_exercise_library
โŒ No write privileges๐Ÿ“– User's custom exercise database and workout presets (isolated to when context is switched).

โŒ Profile, dashboard layout, and onboarding data are not readable โ€” this permission alone is insufficient.
Share Integrations
share_external_providers
โŒ No write privileges (cannot add, edit, or delete provider configurations โ€” owner-only).๐Ÿ“– Allows the family & friends to use the owner's non-private search provider configurations (e.g., FatSecret, USDA, OpenFoodFacts) to search for food and exercise items and add them to their own library.

โŒ Health integrations (Garmin, Fitbit, Withings, Google Health, Polar, Strava, Hevy) are strictly private and never shared โ€” this permission does not grant access to them.

Security & Boundary Isolation

1. Tier 1: Strictly Private Data

Certain tables contain private user data that is never accessible to any family member or friend, regardless of the permission level. This includes:

  • API Keys (api_key table)
  • OIDC SSO Connections (user_oidc_links table)
  • Personal AI Assistant Chat History (sparky_chat_history table)
  • Cycle & Pregnancy hub data (cycle_settings, cycle_daily_entries, cycles, user_cycle_display_preferences, cycle_test_entries, pregnancies, pregnancy_kick_sessions, pregnancy_contractions, pregnancy_photos, pregnancy_checklist_state, health_appointments tables) โ€” this reproductive-health data is never shared or delegated, even with can_view_reports. It is strictly owner-only.

2. Tier 2: Read-Only Profile & Settings Data

The following data can be read by delegates who hold at least one of can_manage_diary, can_manage_checkin, can_manage_medications, or can_view_reports โ€” but only the account owner can modify it:

  • Profile information (profiles table โ€” name, date of birth, height, avatar, etc.)
  • General preferences (user_preferences table โ€” themes, units)
  • Nutrient column display preferences (user_nutrient_display_preferences)
  • Dashboard widget layout (user_dashboard_layouts)
  • Onboarding data and completion status (onboarding_data, onboarding_status)

Delegates with only library permissions cannot read or write any of the above.

3. Context-Switched Library Isolation

Your custom food library, recipes, custom exercises, and medication inventory are only visible to delegates when they have switched their active profile context to your profile. This prevents their personal libraries/cabinets from being cluttered with your items.

4. Automatic Token Validation & Expiry

If you set an Access End Date for a connection, the database automatically revokes all database read/write access the moment that timestamp passes. No manual action is needed.

5. Meal-to-Meal Composition

A meal's ingredient list can link another reusable meal (e.g. a sauce or side) instead of a plain food. Linking a sub-meal into a parent meal requires the same library access to the sub-meal that reading it directly would require โ€” you cannot link a sub-meal you cannot otherwise view. This check applies independently of, and in addition to, owning the parent meal.