This is an example Phoenix LiveView application that uses
Electric.Phoenix.LiveView.electric_stream/4
to sync data from Postgres into a LiveView using
Phoenix Streams.
This keeps the LiveView automatically in-sync with Postgres, without having
to re-run queries or trigger any change handling yourself.
See the documentation for more details.
To start your Phoenix server:
- Run
mix electric.start
to start an Electric instance and associated Postgres DB. - Run
mix setup
to install and setup dependencies - Start Phoenix endpoint with
mix phx.server
or inside IEx withiex -S mix phx.server
Now you can visit localhost:4000
from your browser.
If you open two separate windows, you will see you changes happen simultaneously in both windows.
See the Electric.PhoenixExampleWeb.TodoLive.Index
module and the
Electric.Phoenix
documentation.