Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Supabase 5 min read How-to mediumAdept

Postgres Realtime location sharing with MapLibre

Live location sharing is built by having a Telegram bot running in a Supabase Edge Function (grammY on Deno) capture edited-location updates and write them to Postgres through a PL/pgSQL RPC. The RPC looks up the user's active session and stores the coordinates as a PostGIS point. A React/Next.js client subscribes to Supabase Realtime postgres_changes INSERT events, filtered by event_id, and renders markers with react-map-gl and MapLibre GL JS over a Protomaps basemap served from Supabase Storage.

Assumes: PostGIS basicsReact hooksSupabase client SDK

Related posts

  • Making a Real-Time Chat App with Supabase on Replit

    Replit mediumAdept

    A real-time public chat app can be built with a Vue 3 and Tailwind CSS frontend on Replit backed by Supabase's hosted Postgres. The walkthrough creates a messages table via SQL, enables replication-based real-time events, and wraps the supabase-js client in a Vue composable. That composable handles paginated message loading by range, INSERT subscriptions for live updates, and inserts for sending. Users are identified only by a random username stored in localStorage, and older messages load when the list is scrolled to the top.

  • Geo Queries with PostGIS in Ionic Angular

    Supabase mediumAdept

    PostGIS on Supabase handles geo data for an Ionic Angular app with a Capacitor Google Map. A stores table holds geography(POINT) locations behind a GIST spatial index. Two SQL functions do the geo queries: nearby_stores orders stores by the <-> distance operator and returns st_distance in meters, and stores_in_view filters with && against an ST_MakeBox2D bounding box. The app calls them via Supabase RPC, inserts locations as WKT POINT(long lat) strings, uploads store images to Supabase Storage, and covers the native location permissions and API keys needed for iOS and Android.

  • Building an Uber Clone with Flutter and Supabase

    Supabase mediumAdept

    An Uber-style consumer ride app can be built with Flutter on top of Supabase, using PostGIS geography columns to store driver locations and Supabase Realtime to stream the driver's position onto a Google Map. The tutorial walks through the drivers and rides schema, with generated latitude/longitude columns and row-level security policies. A trigger keeps driver availability in sync with ride status, and a security-definer find_driver function uses ST_DWithin and KNN ordering to pick the nearest available driver within 3,000 m and create the ride. On the client, a five-state Flutter UI calls an Edge Function wrapping Google's Routes API to draw the route polyline, compute a fare and subscribe to ride and driver updates.

  • Realtime: Multiplayer Edition

    Supabase mediumAdept

    Supabase Realtime's Broadcast and Presence features are now generally available, with every feature organized around Channels that also carry Postgres change events. Broadcast is ephemeral pub/sub that bypasses the database, which suits things like cursor positions. Presence syncs shared state to new joiners and drops users automatically when they disconnect. Realtime originally chose logical replication over LISTEN/NOTIFY because NOTIFY payloads are capped at 8,000 bytes. It now runs as a globally distributed Elixir cluster on Fly, using Phoenix PubSub for Broadcast and the delta-CRDT-based Phoenix Tracker for Presence, and supabase-js examples show both features in use.

  • Neon now has realtime

    Neon mediumAdept

    Neon Realtime, now in free public beta, turns any read-only deterministic SQL query (joins, aggregates, window functions, subqueries) into a live query whose result stays updated as data changes, running inside Postgres rather than as a separate realtime service. A TypeScript SDK lets backends define queries via raw SQL, Drizzle or Kysely and "seal" them so browsers or agents can subscribe safely, with React's useLiveQuery, optimistic writes confirmed via awaitTxId, SSR and TanStack DB support. Clients connect to Neon's ingress layer so subscriptions don't block scale-to-zero, incremental maintenance runs on a replica without consuming connections, and Realtime is enabled per branch. Beta limits include no row-level security, no published benchmarks, a changing protocol and four regions.

The quest for software engineering knowledge.

Look:
Layout: