GraphQL, meet LiveGraph: a real-time data system at scale
LiveGraph is Figma's real-time data layer on Postgres: frontend code declares GraphQL-like live queries via a React useSubscription hook, and the server keeps results updated by tailing the Postgres write-ahead log distributed over Kafka instead of polling. Each view is decomposed into a tree of join-free single-table subqueries. An index of active subqueries routes replication-stream changes to the right cached results, and subqueries are shared across users to cut database load. The client is isomorphic with the NodeJS server and receives ordered, exactly-once incremental updates, with permission checks and optimistic updates built in. Performance-critical parts are written in Go, a single instance currently handles about 10,000 writes/second, and open problems include sharding, thundering-herd reconnects after deploys, and pagination of live views.
Related posts
- Keeping it 100(x) with real-time data at scale
Figma mediumAdept
Figma rebuilt LiveGraph, its real-time GraphQL-like subscription service over Postgres, to scale reads and database update load 100x as the database moved from one instance to vertical and horizontal shards. The old design tailed a single globally ordered replication stream into per-server mutation-based caches, which caused excessive fan-in and fan-out, fragmented caches, thundering herds on deploy, and stalled optimistic updates whenever any shard blipped. Two traffic findings drove the redesign: most data is delivered by initial reads rather than live updates, and most queries can be invalidated directly from a row mutation. The result is a three-tier Go system: an edge that expands views, a read-through cache sharded by query hash, and stateless invalidators sharded like the databases that tail the replication streams and send invalidations only to the relevant cache shards.
- 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.
- pg_graphql: A GraphQL extension for PostgreSQL
Supabase mediumAdeptpg_graphql is an open-source PostgreSQL extension, written in C and SQL, that reflects a GraphQL schema from existing tables and resolves queries entirely inside the database. Supabase built it because its 1 GB free-tier VMs had no memory left for a separate GraphQL process like Graphile or Hasura. Each GraphQL request is transpiled into a single SQL statement that aggregates results as JSON. This avoids N+1 queries, respects row level security, and gives multi-operation requests transactional semantics. Pagination follows the Relay connection spec using keyset pagination, the API is one SQL function (gql.resolve) exposed over HTTP via PostgREST, and a benchmark shows about 2,205 requests/second on a 4-core machine.
- TanStack DB with Sync – the future of real-time UI
Neon mediumAdept
Pairing TanStack DB with the ElectricSQL sync engine gives web apps end-to-end real-time updates and optimistic mutations, with Postgres as the source of truth. ElectricSQL uses Postgres logical replication and HTTP long-polling to push changes to clients and handles reads only, so writes still go through normal server actions or APIs. TanStack DB collections map to tables, apply optimistic inserts, updates and deletes through callbacks that roll back on failure, and support live queries with SQL-like filters and joins. A Next.js and Neon contacts demo shows the collection setup, the live queries, and a proxy endpoint that enforces auth and adds per-user row filters before forwarding requests to Electric.
- Realtime: Multiplayer Edition
Supabase mediumAdeptSupabase 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.