---
title: "Postgres Realtime location sharing with MapLibre"
description: "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."
url: "https://swe.quest/articles/postgres-realtime-location-sharing-with-maplibre-f6d03ffa8efe5716"
canonical: "https://supabase.com/blog/postgres-realtime-location-sharing-with-maplibre"
source: "Supabase"
published: "2024-07-04"
difficulty: "medium"
kind: "How-to"
reading_minutes: 5
tags: ["realtime","geospatial","postgres","react","serverless"]
---

# Postgres Realtime location sharing with MapLibre

A post on [Supabase](https://swe.quest/sources/supabase.md), published 2024-07-04, 5 min read, How-to. Original: [https://supabase.com/blog/postgres-realtime-location-sharing-with-maplibre](https://supabase.com/blog/postgres-realtime-location-sharing-with-maplibre)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Real-time systems](https://swe.quest/tags/realtime.md) (Backend & APIs)
- [Maps & geospatial](https://swe.quest/tags/geospatial.md) (Domains)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [React](https://swe.quest/tags/react.md) (Web & mobile)
- [Serverless](https://swe.quest/tags/serverless.md) (Backend & APIs)

## Prerequisites

- PostGIS basics
- React hooks ([easy posts on React](https://swe.quest/tags/react.md?difficulty=easy))
- Supabase client SDK ([easy posts on API design](https://swe.quest/tags/api-design.md?difficulty=easy))

## Keywords

Supabase Realtime, Supabase Edge Functions, MapLibre GL JS, PostGIS, Telegram Bot API, grammY, Protomaps, react-map-gl

## Related posts

- [Making a Real-Time Chat App with Supabase on Replit](https://swe.quest/articles/making-a-real-time-chat-app-with-supabase-on-replit-0a77c4de25e9cc9d.md): Replit · 2022-03-23 · Medium · 8 min read · Real-time systems, Frontend, JavaScript, PostgreSQL
  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.
- [Geo Queries with PostGIS in Ionic Angular](https://swe.quest/articles/geo-queries-with-postgis-in-ionic-angular-9afa3d65d6fa3030.md): Supabase · 2023-03-01 · Medium · 20 min read · PostgreSQL, Maps & geospatial, Mobile, Frontend
  PostGIS on Supabase handles geo data for an Ionic Angular app with a Capacitor Google Map.
- [Building an Uber Clone with Flutter and Supabase](https://swe.quest/articles/building-an-uber-clone-with-flutter-and-supabase-eaa64bc8188b0796.md): Supabase · 2024-09-05 · Medium · 15 min read · Mobile, PostgreSQL, Maps & geospatial, Real-time systems
  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.
- [Realtime: Multiplayer Edition](https://swe.quest/articles/realtime-multiplayer-edition-cca475e0a0be51ab.md): Supabase · 2022-08-18 · Medium · 8 min read · Real-time systems, Elixir & Erlang, PostgreSQL, JavaScript
  Supabase Realtime's Broadcast and Presence features are now generally available, with every feature organized around Channels that also carry Postgres change events.
- [Neon now has realtime](https://swe.quest/articles/neon-now-has-realtime-b9ed3cc150e396ae.md): Neon · 2026-10-15 · Medium · 10 min read · Real-time systems, PostgreSQL, TypeScript, React, AI for coding
  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.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
