Hacker News new | ask | show | jobs
by aidos 553 days ago
We hit on exactly the same pattern for our product and it works really well.

We use Hasura as the read engine. That updates a graph of mobx objects that drive the ui. We apply updates directly to those objects so the ui updates immediately. The mutations are posted back to a Python api that applies them to the db.

I’ve looked at Electric because we’ve had to recreate some of what they do to interface with Hasura. At the moment it’s a non-starter because we use pg views to shape the data for the frontend.

2 comments

Have you looked into something like Materialize? That’d give you realtime updates over even materialised views, works to back Hasura etc.
Hadn’t seen that one. Thanks for the heads up. It’s the sort of thing that I could see being useful in a bunch of places. We have a number of hand rolled things to deal with similar issues.

Might not be a perfect fit here because some of the views are session context dependent (but could maybe still be workable).

Would love to read more about how you have mobx structured here. I have a similar graph of mobx objects for something I’m building but haven’t come up with an ergonomic sync story yet.
Mine is simple but relies on a few cheap tricks (like generating uuids in the frontend and manually linking relationships in an order where replaying on the db is going to work). Happy to walk you through it if you want to message me.