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

Rustixir
Hi everyone, im working on find best language/framework/system for high concurrency, high performance and stable performance after wor...
New
crispinb
On reading dhh’s latest The One Person Framework it strikes me that Phoenix with LiveView is already pretty much this. However, never hav...
New
lucaong
Hello Elixir and Nerves community, I have been working for a while on an open-source embedded key-value database for Elixir, that I call...
230 14049 124
New
Crowdhailer
I’ve been hearing much about the new formatter and it’s something I have been keen to try. I find examples buy far the most illuminating...
248 19365 150
New
CharlesO
Erlang :list.nth simple, but 1 - based nth(1, [H|_]) -> H; nth(N, [_|T]) when N > 1 -> nth(N - 1, T). Elixir Enum.at … coo...
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
New
eteeselink
Hi all, In the last days, two things happened: A blog post titled “They might never tell you it’s broken” made the rounds. It’s about ...
New
AstonJ
Can you believe the first professionally published Elixir book was published just 8 years ago? Since then I think we’ve seen more books f...
New
Qqwy
Looking at the stacks that existing large companies have used, WhatsApp internally uses Mnesia to store the messages, while Discord uses ...
New

Other popular topics Top

marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
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
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
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
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

We're in Beta

About us Mission Statement