kuligkar

kuligkar

Moving Supabase's realtime-js back onto canonical Phoenix.js (+ some Logflare internals)

We recently wrapped a project with Supabase and wrote it up. Sharing here because a good chunk of it is Phoenix and Elixir internals this crowd might enjoy picking apart.

Two parallel tracks:
realtime-js → canonical Phoenix.js

realtime-js (the SDK behind Supabase Realtime, ~20M weekly downloads) was running on a fork of Phoenix.js that had drifted a long way from upstream. The goal was to drop the fork and wrap canonical Phoenix.js instead, with the public API unchanged. A few things that came up:

  • Phoenix.js ships JSDoc but no real types, and some of it referenced types that didn’t exist. We wrote proper TS definitions while keeping changes minimal so future Phoenix.js updates stay easy to pull in.
  • We hit a silent double-subscribe edge case (subscribing to the same channel twice gets blocked by how Phoenix.js tracks channel state). Fixed with a helper that handles callback transfer and channel recreation, plus a few small upstream PRs.
  • Testing a client lib without running the whole platform: we built a browser-based Realtime explorer and an Expo app, then ran automated tests against the real library. The Expo app also let us reproduce and fix the long-standing RN issue where the WebSocket drops on backgrounding and doesn’t restore cleanly (now handled with lifecycle hooks).

Logflare (the Elixir side)

Logflare is Supabase’s distributed observability app. We joined as external contributors and:

  • Rebuilt ingestion rule evaluation. It was a linear scan checking every rule against every event; we moved it to a tree that prunes branches early, getting close to logarithmic.
  • Moved BigQuery ingestion off the deprecated REST API onto the gRPC Streaming API (smaller payloads, less outbound traffic, lower GCP spend at that volume).
  • Added export adapters for Axiom, Last9, and OTLP, which became the groundwork for Supabase’s Log Drains.

Full write-up: Modernizing RT Infrastructure and Observability for Supabase

I know a good Elixir project case study is something we all like to read :slight_smile: Would be interested to hearing your thoughts about this one!

Most Liked

filipecabaco

filipecabaco

We worked directly with the Software Mansion team and they did an awesome job. Special thank you to the team :star_struck:

Where Next?

Popular in Discussions Top

vans163
So useless benchmarks aside, Its possible to write a webserver that can serve 300k requests per second (perhaps more with optimizations)....
New
PragTob
Hello everyone, I know we had quite some threads (read through lots of them) about background job processing but it remains a hotly deba...
New
blackode
Elixir Upgrading is so Simple in Ubuntu and It worked for me Ubuntu 16.04 git clone https://github.com/elixir-lang/elixir.git cd elixir...
New
jswny
I would like to better understand what the advantages/disadvantages of umbrella applications are compared to structuring your app as as s...
New
mmmrrr
Just saw that dhh announced https://hotwire.dev/ Is it just me or is this essentially live view? :smiley: Although I like the “iFrame-e...
New
ricklove
I was just introduced to Elixir and Phoenix. I was told about the 2 million websocket test that was done 2 years ago. From my research, t...
New
lorenzo
Hey everone! I created a prototype for my app using Nodejs for the api. But the framework I chose wasnt great (in general theresnt any g...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
restack_oslo
Hello, Please pardon me for any faux paux. I am 46 and this is my first time on a forum of any kind. I wanted to to get answers from tho...
New
MarioFlach
Hello, I want to share a project I’ve been working on for a while: https://github.com/almightycouch/gitgud Background Some time ago I ...
New

Other popular topics Top

axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 48475 226
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43806 214
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement