Phoenix.Sync is a library that adds real-time sync to Postgres-backed Phoenix applications. Use it to sync data into both LiveView and front-end web and mobile applications.
- integrates with
Plug
andPhoenix.{Controller, LiveView, Router, Stream}
- uses ElectricSQL for core sync, fan-out and data delivery
- maps
Ecto.Query
s to Shapes for partial replicationThere are four key APIs for read-path sync out of Postgres:
Phoenix.Sync.Client.stream/2
for low level usage in ElixirPhoenix.Sync.LiveView.sync_stream/4
to sync into a LiveViewPhoenix.Sync.Router.sync/2
macro to expose a shape in your RouterPhoenix.Sync.Controller.sync_render/3
to return shapes from a ControllerAnd a
Phoenix.Sync.Writer
module for handling write-path sync back into Postgres.
continue reading on hexdocs.pm
⚠️ This post links to an external website. ⚠️
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.