Great, that helps a lot!
So the helpers in the node package linked above are middleware designed to hook into an Express server. This is functionally equivalent to how the Ruby gem operates. The logic is simple enough: POST requests or GET requests that throw write exceptions are replayed in the primary region. We wrote about this approach in detail in this blog post.
However, this is a bit harder to pull off in a generic way with GraphQL servers, since all requests are POSTs. But the natural separation between write mutations and read queries may be helpful here. If your framework has a way to inject some “middleware” - or anywhere pre-request - it should be possible to centralize logic to decide which requests should be replayed.
This is the first step. The gotchas exist in the space of reads that write. Like writes to statistics tables, or a last_seen_at
field every time a user hits the app. These are good candidates for the prismaWrite
concept.
If you could provide some example code using the frameworks you chose, we can work from there! Or feel free to DM and invite to a private repo if that works for you.
Joshua