Engineering
Technical architecture
A pragmatic stack chosen to ship a premium mobile MVP within $20k while remaining production-grade and scalable to 1M+ users.
Mobile framework: React Native (recommended)
| Criteria | React Native | Flutter | Winner |
|---|---|---|---|
| Hiring pool | Largest JS/React talent pool | Smaller, Dart-specific | RN |
| Mapbox SDK | First-class @rnmapbox/maps | flutter_mapbox_gl less mature | RN |
| 3rd-party libs | Vast — Stripe, Sentry, Posthog all native | Growing but gaps remain | RN |
| Animation polish | Reanimated 3 + Skia, excellent | Flutter native — slightly better OOTB | Flutter |
| MVP velocity at $20k | Highest with Expo + EAS Build | Comparable | RN |
| Bundle size | ~25MB | ~15MB | Flutter |
| Code reuse w/ future web | Easy via React Native Web | Harder | RN |
Decision: React Native (Expo SDK, EAS Build, Reanimated 3, Skia for cosmic effects, @rnmapbox/maps).
Backend: Supabase (recommended)
| Criteria | Supabase | Firebase | Node + Postgres | Winner |
|---|---|---|---|---|
| Auth (Apple/Google/email) | Built-in | Built-in | Build yourself | Tie |
| Geospatial queries | PostGIS native | GeoFire workaround | PostGIS native | Supabase |
| Realtime updates | Postgres logical replication | First-class | Build yourself | Firebase |
| Vendor lock-in | Low — portable Postgres | High | None | Supabase |
| MVP cost @ 10k MAU | ~$25/mo | ~$80/mo (Firestore reads) | ~$60/mo + ops time | Supabase |
| Storage | S3-compatible buckets | Firebase Storage | S3/R2 | Tie |
Decision: Supabase — PostGIS gives us radius search, polygon queries, and clustering for free; portable Postgres avoids lock-in.
Infrastructure overview
┌────────────────────────────────────────────────────────────────┐
│ React Native (Expo) │
│ Screens · Reanimated · Mapbox · Zustand · TanStack Query │
└────────────────────────┬───────────────────────────────────────┘
│ HTTPS / WSS
┌────────────┴────────────┐
│ │
┌────────▼─────────┐ ┌──────────▼───────────┐
│ Supabase Edge │ │ Mapbox API │
│ Functions │ │ - Tiles │
│ (Deno · TS) │ │ - Geocoding │
│ - createMarker │ │ - Static maps │
│ - feedRank │ └──────────────────────┘
│ - aiRecs (Ph 2) │
└────────┬─────────┘
│
┌────────▼─────────────────────────────────────┐
│ Supabase Postgres + PostGIS │
│ - users · markers · ratings · journal · … │
│ - RLS policies │
│ - pg_cron for nightly score recompute │
└────────┬─────────────────────────────────────┘
│
┌────────▼─────────────┐ ┌────────────────────┐
│ Supabase Storage │ │ External services │
│ - photos/ │ │ - Sentry (errors) │
│ - avatars/ │ │ - PostHog (analyt) │
└──────────────────────┘ │ - Resend (email) │
│ - OneSignal (push) │
└────────────────────┘Geospatial strategy
Storage
- PostGIS geography(Point, 4326) on energy_markers.location.
- GIST index for O(log n) radius queries.
- Coordinates rounded to 5 decimals (~1m) for storage.
Clustering
- Server-side: ST_ClusterDBSCAN at zoom ≤ 11.
- Client-side: supercluster.js for zoom 12+ for smooth interactions.
- Edge function caches cluster results in Postgres-backed KV (5 min TTL).
GPS verification
- Edge function recomputes distance between submitted coord and Mapbox-validated location.
- Reject if Δ > 100m or accuracy > 50m.
- Time-of-day + speed heuristics to flag spoofing.
Privacy
- Public read: location fuzzed to nearest 30m grid.
- Owner read: exact coords.
- User home-location never stored.
Map vendor: Mapbox (recommended)
| Feature | Mapbox | Google Maps SDK | Winner |
|---|---|---|---|
| Custom dark cosmic style | Studio editor — full control | Limited theming | Mapbox |
| Pricing at 50k MAU | ~$200/mo | ~$700/mo | Mapbox |
| Offline tile cache | Native support | Premium tier only | Mapbox |
| RN SDK | @rnmapbox/maps — solid | react-native-maps — solid | Tie |
| Vector tiles + perf | Excellent | Excellent | Tie |
Cross-cutting concerns
Observability
Sentry (mobile + edge), PostHog product analytics, Supabase logs.
CI/CD
GitHub Actions → EAS Build → TestFlight & Play Internal.
Feature flags
PostHog flags; killswitch for AI recs, premium gates.
Search
Postgres trigram on titles + Mapbox geocoding for places.
Push
OneSignal — supports iOS critical + Android channels.
Email
Resend for transactional; weekly digest via cron.