I've implemented proxying in Elixir in front of Electric before. For example, in the gatekeeper auth example: https://github.com/electric-sql/electric/blob/main/examples/gatekeeper-auth/api/lib/api_web/controllers/proxy_controller.ex using Req in streaming mode.
I'm now working on a Phoenix.Sync app and have been eyeballing:
- how best to implement a proxying controller
- whether we can extract some logic to make this easier / build some proxy apis into Phoenix.Sync
My main question is how to get a "response" from Electric in embedded mode. I.e.: Phoenix.Sync has :embedded mode. When proxying, there isn't necessarily an upstream URL to proxy to.
Is there a way to make a request to the embedded Electric? If not, would exposing an internal shape and then proxying to that internal route be a workaround?
I suspect the answer to this would inform how to approach providing function or even macro APIs.