nowfound

Life & fun · September 28, 2023

TE

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,…

What it does

In the maker’s words, at launch

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

Does the same job

all alternatives →
  • TheSprkl Chrome Extension for Webflow2024 · ▲128

    Copy and sync components with Class Sync Chrome Extension

  • Coupler.io2021 · ▲150

    Sync apps with Google Sheets on schedule, no coding required

  • HaxiomNov 2025 · ▲125

    The Online MD Editor for Collaborative Teams

  • PA
  • IR
    Intercept.rest – Faster API debugging2018 · ▲89

    Sharing an internal tool that accelerated my development work 10-fold, especially with API debugging. Thought fellow developers here might find it useful. As a developer, I often have trouble reproducing errors at the client end. https://intercept.rest lets me debug and monitor API requests and responses. It is similar to the Network tab in Chrome Developer Tools but works for any API: mobile apps, webhooks, frontend etc. After I shared it with a close circle of friends, they found it incredibly useful and even found new use cases, I never imagined. Been a long time lurker here and…

  • IB
    I built a JavaScript UI library with reactive atomic updates2024 · github.com · ▲6

    Hey everyone! Some time ago I was analyzing why React apps are so hard to optimize, and came to a conclusion that the lack of atomic updates is the culprit. I made an experimental library which basically updates everything in place directly in HTML. At some point I became aware that Solidjs exists, which is a very similar idea, but at the end of the day I realized my approach to API is quite different and warrants the existence of my library (my state primitive allows selector subscriptions, array iterators return a state primitive with the element, allowing to never re-render the whole…

More life & fun this month

the category →
  • TL

    Life & fun · 10d ago · louisabraham.github.io

  • Photosynthesis fires two of your iPhone

    Life & fun · 28d ago · photosynthesis.camera

  • SoloUno310

    Take control of hair pulling, nail biting & skin picking

    Life & fun · 28d ago · solouno.io

  • Scroll through all 43,252,003,274,489,856,000 reachable Rubik's Cube permutations.

    Life & fun · 26d ago · everycube.alen.is

  • The Interactive 3D Encyclopedia

    Life & fun · 21d ago · expeditione.fun

  • Hi HN, I built Eigendrum, a web tool that solves the 2D wave equation for arbitrary shapes so you can hear what they sound like as drums. How it works: * Solves -∇²u = λu using finite element analysis (Kφ = λMφ) on a triangle mesh. * Validated to <0.1% error against closed-form solutions for circles (Bessel zeros) and rectangles. * Sound model factors in strike location, Rayleigh damping, and mallet width. * Includes Kac drums I & II to demonstrate identical sound spectra from different geometries. * No frameworks, build steps, or dependencies. Repo and tests:…

    Life & fun · 26d ago · baselashraf81.github.io

Launched alongside, September 2023

the whole month →
  • Loops1,561

    Email made easy

    Dev tools · 2023 · loops.so

  • Tally 2.01,479

    The simplest way to create forms for free

    Dev tools · 2023 · tally.so

  • Klu AI1,466

    Your data, unified and interactive

    AI · 2023 · klu.so

  • FirstHR1,063

    All-in-one HR platform for founders with dreams and teams

    Work · 2023 · firsthr.app

  • DevHunt946

    Open source Product Hunt for dev tools

    Dev tools · 2023 · devhunt.org

  • GenAI app to create personalized content

    AI · 2023 · yarnit.app