To

Topical – Elixir library for synchronising state to web clients

Hacker News

Topical – Elixir library for synchronising state to web clients

Hi HN. I've been working on an Elixir library for synchronising state, maintained by the server, to connected web clients. I found this was something I kept implementing for side-projects, so I've extracted it into a library. It solves a similar problem to Phoenix LiveView, but aimed at a different level of abstraction: rather than synchronising HTML and UI events, this just synchronises (JSON-serialisable) state. Topics can be shared between connected users, and each client can subscribe to multiple topics. The library takes care of starting topic instances (GenServer processes) as needed, then shuts them down when they're no longer in use. A topic is defined with an initialisation function (which can be used to load the initial state and/or subscribe to updates from a database/etc), and can then respond to requests/notifications from clients, or arbitrary BEAM messages, to efficiently update (and synchronise) state. The library can be used directly from Elixir, or there's a Cowboy adapter that can be used along with the JavaScript client or React hook. I've put together a few very basic examples. Some use cases I think this works great for are, a) synchronising ephemeral state (e.g., cursor positions); b) as a layer over a database for synchronising real-time updates to persisted state. In particular, this works pretty well for event-sourcing-type scenarios - you can load events from the database, subscribe to updates, and (if needed) periodically take snapshots of the state. Please let me know what you think. https://github.com/joefreeman/topical

Share card

Actual performance

8points
Made the leaderboard

Launch Intel predictions

Analyze your own launch →
Product HuntOn track for Day 1 leaderboard · Strong signals: cursor, user · Missing: mac, agents, macos
85%85% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Indie HackersFits the IH revenue-focused audience · Strong signals: ios, efficiently · Missing: supports, reddit linkedin, podcasting
74%74% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
Hacker NewsStrong engagement from HN community · Strong signals: ide, io · Missing: https docs, excited, just released
65%65% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
TrustMRRLess likely to generate early MRR · Strong signals: ios, users · Missing: mobile apps, personal, entrepreneurs
43%43% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
AppSumoMay struggle as an AppSumo deal · Strong signals: efficient, users · Missing: plus, platform, intuitive
34%34% predicted probability of success on AppSumo, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Missing: arr, mrr, revenue
13%13% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Correct prediction on native model

Similar products

Ma
Machinery – A State Machinery Library for Elixir (and Phoenix)72%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Machinery – A State Machinery Library for Elixir (and Phoenix)

Hacker News5
I
I made a state management library50%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

I made a state management library

Hacker News2
Le
Legend-State 1.0 – The fastest React state library53%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Legend-State 1.0 – The fastest React state library

Hacker News5
“J
“Java Retrofit” for C++. Build Web Clients with Oatpp ApiClient/libcurl37%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

“Java Retrofit” for C++. Build Web Clients with Oatpp ApiClient/libcurl

Hacker News2
La
Last System State Before OOM49%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Last System State Before OOM

Hacker News1
Re
ReSift – a React state management library for fetches42%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

ReSift – a React state management library for fetches

Hacker News3
A
A small, functional state management library42%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A small, functional state management library

Hacker News4
Lu
Luciex – A small simplistic state management library39%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Luciex – A small simplistic state management library

Hacker News19
Vu
Vuex-light – state management library for Vue 347%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Vuex-light – state management library for Vue 3

Hacker News4
1k
1kb progressive state management library inspired by Vuex39%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

1kb progressive state management library inspired by Vuex

Hacker News1