Menu

Live riders on a map: Supabase Realtime + Mapbox in React Native (and the bill nobody warns you about)
📰

Live riders on a map: Supabase Realtime + Mapbox in React Native (and the bill nobody warns you about)

DEV Community: typescript·Andrii Skumin·about 1 hour ago
#TUYVNuzV
#devtotypescript#devto#dev#every#real
Reading 0:00
15s threshold

In my previous post I said I'm building a motorcycle app. The feature people ask about most is the live map : open it, see riders who are on the road right now, moving in real time.

With ten users it's easy. With real users it gets interesting. Here is how it works in BRAP (Expo + Supabase + Mapbox), and what production taught me.

The idea: one row per ride

A ride in progress is a single row with a user id, lat, lng and a timestamp. Row exists = riding. Ride ends = row deleted. Everything else follows:

who is riding? a select

someone moved? an UPDATE event

someone stopped? a DELETE event

The phone writes its position from a background task ( expo-location ). Two details that cost me days:

iOS only honours distanceInterval . timeInterval is ignored by the native code. A tick every 25 m means the update rate follows the speed, which is what you want anyway.

Android needs foregroundService .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.