Energy Atlas
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)

CriteriaReact NativeFlutterWinner
Hiring poolLargest JS/React talent poolSmaller, Dart-specificRN
Mapbox SDKFirst-class @rnmapbox/mapsflutter_mapbox_gl less matureRN
3rd-party libsVast — Stripe, Sentry, Posthog all nativeGrowing but gaps remainRN
Animation polishReanimated 3 + Skia, excellentFlutter native — slightly better OOTBFlutter
MVP velocity at $20kHighest with Expo + EAS BuildComparableRN
Bundle size~25MB~15MBFlutter
Code reuse w/ future webEasy via React Native WebHarderRN
Decision: React Native (Expo SDK, EAS Build, Reanimated 3, Skia for cosmic effects, @rnmapbox/maps).

Backend: Supabase (recommended)

CriteriaSupabaseFirebaseNode + PostgresWinner
Auth (Apple/Google/email)Built-inBuilt-inBuild yourselfTie
Geospatial queriesPostGIS nativeGeoFire workaroundPostGIS nativeSupabase
Realtime updatesPostgres logical replicationFirst-classBuild yourselfFirebase
Vendor lock-inLow — portable PostgresHighNoneSupabase
MVP cost @ 10k MAU~$25/mo~$80/mo (Firestore reads)~$60/mo + ops timeSupabase
StorageS3-compatible bucketsFirebase StorageS3/R2Tie
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)

FeatureMapboxGoogle Maps SDKWinner
Custom dark cosmic styleStudio editor — full controlLimited themingMapbox
Pricing at 50k MAU~$200/mo~$700/moMapbox
Offline tile cacheNative supportPremium tier onlyMapbox
RN SDK@rnmapbox/maps — solidreact-native-maps — solidTie
Vector tiles + perfExcellentExcellentTie

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.