How aditya-singh2005/connecti works
1. Purpose and Runtime Shape
Connecti is an Android-focused Expo/React Native prototype for privacy-preserving reconnection among existing friends. Its core journey is geofence entry → voluntary Wave/presence → mutual hint/reveal consent → BLE-verified meetup. The client is backed primarily by Supabase, with Firebase/FCM and Expo push paths, native Android location workers, and separate Python ML engines.
2. Mobile Application and Navigation
Expo Router screens define authentication, profile creation, and the home-area social workflow. The app bootstrap and route shells are at app/_layout.jsx, app/index.jsx, and app/home/_layout.js. Primary product surfaces include home, chat, friends, discovery, profile, permission, proximity, and geofence testing under app/home/HomeScreen.jsx, app/home/ChatScreen.jsx, and app/home/GeofenceTestScreen.jsx.
3. Identity, Social Data, and Consent Boundary
Authentication state is centrally owned by context/AuthProvider.jsx; the Supabase client boundary is lib/supabase.js. Friend relationship operations are exposed to UI through hooks/useFriendships.jsx, while Wave lifecycle behavior is encapsulated in services/WaveService.js. These layers should enforce the product invariant that only established friends participate and identities are withheld until bilateral approval.
4. Geofence-Driven Presence Pipeline
JavaScript geofence orchestration spans components/GeofenceController.js, hooks/useGeofenceService.js, and services/GeofenceManager.js. Background task handling begins at tasks/geofenceTask.js. Android-native geofence registration/bridging and background maintenance are implemented in android/app/src/main/java/com/aditya/connectiapp/NativeGeofenceModule.kt, android/app/src/main/java/com/aditya/connectiapp/GeofenceBroadcastReceiver.kt, and android/app/src/main/java/com/aditya/connectiapp/GeofenceRefreshWorker.kt.
5. Native Android Background Execution
The Android app hosts React Native through android/app/src/main/java/com/aditya/connectiapp/MainActivity.kt and android/app/src/main/java/com/aditya/connectiapp/MainApplication.kt. WorkManager-style workers cover zone polling/sync, expired Waves, and inactive presence: ZonePollWorker.kt, ZoneSyncWorker.kt, WaveExpiryWorker.kt, and PresenceInactivityWorker.kt in the same Android package. BootCompletedReceiver.kt restores relevant background behavior after device restart.
6. Proximity and Meetup Verification
BLE discovery and proximity notifications are modeled as React hooks: hooks/useBLEService.js, hooks/useBLENearbyFriends.js, and hooks/useBLEProximityNotifications.js; shared BLE logic is in lib/bleutils.js. This is the physical-verification boundary for the final Connect phase, distinct from geofence-based coarse presence.
7. Notifications and Server-Side Integrations
Client notification setup, token handling, and test surfaces are in components/NotificationHandler.jsx, services/ExpoPushTokenService.js, and services/FCMTokenService.js. Android notification creation is native in android/app/src/main/java/com/aditya/connectiapp/NotificationHelper.kt. Delivery can route through a Vercel-style push API (connect-push-api/api/send-notification.js), Firebase Cloud Functions (functions/index.js), or Supabase Edge Function chat notifications (supabase/functions/send-chat-notification/index.ts).
8. Persistence and Decision Support
Supabase provides database/backend services; database behavior includes stale-presence cleanup in supabase/migrations/auto_cleanup_stale_presence.sql. The standalone Python ML subsystem calculates relationship strength, hints, and reunion probability using profile embeddings: ml/engines/relationship_strength.py, ml/engines/hint_generator.py, and ml/engines/reunion_probability.py. It is a decision-support boundary rather than an embedded mobile runtime.
Main entry points: supabase.js Supabase backend · WaveService.js Wave consent lifecycle · NotificationHandler.jsx Client notifications · _layout.jsx Routes and product screens
Components 19
Expo mobile app
- Routes and product screens · Authentication and home social surfaces.
app/_layout.jsx - Auth state
context/AuthProvider.jsx - Friend relationships · Limits social participation to established friends.
hooks/useFriendships.jsx - Wave consent lifecycle · Manages voluntary presence and bilateral reveal consent.
services/WaveService.js - BLE meetup verification · Verifies nearby friends after coarse geofence presence.
hooks/useBLEService.js - Client notifications
components/NotificationHandler.jsx
Presence pipeline
- Geofence controller
components/GeofenceController.js - Geofence orchestration
hooks/useGeofenceService.js - Background geofence task
tasks/geofenceTask.js
Android native runtime
- Native geofence bridge · Registers Android geofences for the React Native layer.
android/app/src/main/java/com/aditya/connectiapp/NativeGeofenceModule.kt - Geofence event receiver
android/app/src/main/java/com/aditya/connectiapp/GeofenceBroadcastReceiver.kt - Background maintenance · Refreshes geofences and cleans expired waves or inactive presence.
android/app/src/main/java/com/aditya/connectiapp/GeofenceRefreshWorker.kt - Android app host
android/app/src/main/java/com/aditya/connectiapp/MainApplication.kt
Backend and delivery
- Supabase backend · Primary persistence, auth, and realtime boundary.
lib/supabase.js - Stale presence cleanup
supabase/migrations/auto_cleanup_stale_presence.sql - Push delivery API
connect-push-api/api/send-notification.js - Firebase push functions
functions/index.js - Chat notification function
supabase/functions/send-chat-notification/index.ts
Decision support
- Relationship ML engines · Computes relationship strength, hints, and reunion probability from profile embeddings.
ml/engines/relationship_strength.py
Connections 23
- Routes and product screens → Auth state: reads session
- Routes and product screens → Friend relationships: social UI
- Routes and product screens → Wave consent lifecycle: creates and approves
- Auth state → Supabase backend: auth state
- Friend relationships → Supabase backend: friend graph
- Wave consent lifecycle → Supabase backend: waves and consent
- Geofence controller → Geofence orchestration: controls
- Geofence orchestration → Native geofence bridge: registers zones
- Native geofence bridge → Geofence event receiver: Android transitions
- Geofence event receiver → Background geofence task: dispatches event
- Background geofence task → Wave consent lifecycle: updates presence
- Background maintenance → Supabase backend: syncs and cleans
- Android app host → Native geofence bridge: hosts module
- Android app host → Background maintenance: schedules work
- Wave consent lifecycle → BLE meetup verification: eligible mutual meetup
- BLE meetup verification → Client notifications: nearby alert
- Client notifications → Push delivery API: push delivery
- Client notifications → Firebase push functions: FCM delivery
- Supabase backend → Chat notification function: chat events
- Chat notification function → Client notifications: pushes chat alert
- Supabase backend → Stale presence cleanup: applies cleanup
- Supabase backend → Relationship ML engines: profile inputs
- Relationship ML engines → Wave consent lifecycle: hints and probability