electric-sql/phoenix_sync
55.1
Adequate · 18 September 2026
9.9k
lines of production code
Elixir
primary language
1
measurement over time
What this system is
Phoenix.Sync is an Elixir library that enables real-time data synchronization between Postgres-backed Phoenix or Plug applications and clients via Electric. It provides APIs for read-path streaming, write-path optimistic updates, and LiveView integration, while also offering Igniter tasks to scaffold React and TanStack DB frontends. The system supports both embedded and HTTP modes, with comprehensive tooling for testing, documentation, and configuration management.
Features
Add Phoenix Sync example application with sandbox test mode
A new example application, \phoenix\_sync\_example\, has been added to demonstrate the Phoenix Sync library. It provides a complete Phoenix web app structure including Ecto schemas for cars and makes, a GenServer-based sync client, and standard web controllers. Notably, the test environment is configured to use \Phoenix.Sync\ in \:sandbox\ mode, enabling isolated database testing via \Ecto.Adapters.SQL.Sandbox\.
_apps/phoenix\_sync\example · high confidence
Add txid\_match app to validate 32-bit transaction ID wrapping
The new \txid\_match\ application provides a validation tool that forces PostgreSQL's transaction IDs (txids) to wrap around, ensuring that the system correctly handles 32-bit txid matching with sync messages. It includes Mix tasks to manage an in-memory PostgreSQL instance and run the validation logic, which compares expected vs. actual txids to detect mismatches caused by integer overflow.
_apps/txid\match · high confidence
Automated documentation generation with live reload
Added scripts to automate the generation of project documentation, including a basic script to run the documentation build and a watcher script that automatically regenerates docs when source files change. The watcher supports live reload via the MIX\_DOCS\_LIVE environment variable and utilizes either fswatch or inotifywait for filesystem monitoring, providing a more efficient development workflow for documentation updates.
scripts · high confidence
Igniter task scaffolds a React + TanStack DB frontend for Phoenix apps
The \phx.sync.tanstack\_db\ igniter task now generates a complete frontend scaffold for Phoenix applications, replacing or supplementing the default stack with React, TanStack Router, and TanStack DB. This includes a Vite-based build configuration, Tailwind CSS styling, and a sample to-do application that demonstrates local-only data management via \@tanstack/react-db\. The generated assets also provide an API layer for authentication and mutation ingestion, along with a Caddyfile for local development proxying, enabling developers to quickly adopt this specific sync stack.
_priv, priv/igniter/phx.sync.tanstack\db · high confidence
Initial release of Phoenix.Sync for real-time Postgres sync
This entry introduces Phoenix.Sync, a library that enables real-time data synchronization between Postgres-backed Phoenix applications and clients. It provides APIs for read-path sync via \Phoenix.Sync.Router.sync/2\ and \Phoenix.Sync.Controller.sync\_render/3\, LiveView integration through \Phoenix.Sync.LiveView.sync\_stream/4\, and write-path handling with \Phoenix.Sync.Writer\ for optimistic updates. The release includes configuration files (\.formatter.exs\, \.tool-versions\), a Docker setup for local development, and documentation.
(repo-wide) · high confidence
Initial release of PlugSync test application
This change introduces the \plug\_sync\ application, a dedicated test environment for validating Phoenix.Sync features within a real Plug/Phoenix setup. It provides a configurable server (running on port 4444) that supports both HTTP and embedded modes via the \PHOENIX\_SYNC\_MODE\ environment variable. The app includes a sample \items\ table with Ecto migrations, a router demonstrating \sync\ with a custom transform function and \sync\_render\ for interruptible operations, and Mix tasks to seed sample data and start the server.
_apps/plug\sync · high confidence
Introduce Phoenix.Sync for real-time Postgres data synchronization
Adds the \Phoenix.Sync\ library, enabling Phoenix and Plug applications to sync Postgres data in real-time via Electric. This includes a LiveView integration (\Phoenix.Sync.LiveView\) to replace \Phoenix.LiveView.stream/3\ with live-updating streams, controller and router macros (\sync\_render\, \sync\) for exposing shape endpoints, and a client API for generating Elixir streams from Ecto queries or keyword-based shape definitions. The library supports both embedded and HTTP modes for connecting to Electric, handles CORS headers automatically, and allows for dynamic shape definitions and custom authentication.
lib/phoenix · high confidence
New Igniter tasks for Phoenix.Sync installation and TanStack DB frontend setup
Added two new Igniter mix tasks to streamline project configuration: \phoenix\_sync.install\ automates the setup of Phoenix.Sync by configuring dependencies and endpoints for either embedded or HTTP sync modes, while \phx.sync.tanstack\_db.setup\ converts a Phoenix application to use a Vite and TanStack DB frontend by replacing esbuild, adding React dependencies, and configuring routing and controllers.
lib/mix · high confidence
Behavioural changes
Restructured configuration into environment-specific files and added test sandbox support
The application configuration has been reorganized from a single file into environment-specific files (dev, test, runtime), with runtime configuration now handling dynamic setup for the test environment. This change introduces a test sandbox mode for \:phoenix\_sync\ that configures specific Ecto repositories (Support.Repo, Support.ConfigTestRepo, Support.SandboxRepo) with sandbox pooling and detailed logging, while also setting up the Electric library for embedded testing with a dedicated replication stream ID and temporary storage.
config · high confidence
Test coverage
Added comprehensive test suite for Phoenix.Sync core components; Added test support files for LiveView streaming scenarios; Added tests for Phoenix.Sync install and TanStack DB setup tasks.
Dependencies
Add example and test apps with updated dependency constraints
The repository now includes three new Elixir applications—\phoenix\_sync\_example\, \plug\_sync\, and \txid\_match\—alongside the main \phoenix\_sync\ library. These apps serve as examples and test environments, pinning specific versions of the \electric\ library (ranging from 1.1.1 to 1.1.9) and other dependencies like \phoenix\, \ecto\_sql\, and \plug\ to ensure compatibility. The main library's \mix.exs\ also updates its \electric\ dependency constraint to \\>= 1.1.9 and \<= 1.1.10\ and adds \igniter\ as an optional dependency.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 55.
Lenses
- Code Health 99
- Architecture 94
- Maturity 57
- Readiness 48
- Security 83
- Accessibility 49
Changes since last survey
- 78 commits — 65 feature/other, 13 fixes
By area
- lib/phoenix — 35 commits
- (root) — 31 commits
- test/phoenix — 5 commits
- (repo) — 2 commits
- apps/phoenix_sync_example — 1 commit
- apps/plug_sync — 1 commit
- apps/txid_match — 1 commit
- config/test.exs — 1 commit
- priv/igniter — 1 commit
Notable commits
- fix: fix client configuration problem
- fix: fix client.request use
- fix: fix: A send plug response within the request process (#111)
- fix: fix: Bump electric to 1.1.9 (#103)
- fix: fix: Compilation with no Ecto support (#79)
- fix: fix: Forward request headers onto sync backend (#107)
- fix: fix: Handle Electric.ShapeCache api change (#97)
- fix: fix: Liveview setup fails outside test environment (#88)
- fix: fix: handle stack not ready response by returning to client (#104)
- fix: fix: return 32-bit txids to ensure matching with sync messages (#71)
- fix: fix: use new/0 to prevent compilation race condition (#89)
- fix: remove dbg, fix tests, use in-memory kv, bump to version 0.3.1
- fix: router: fix error message (#34)
- change: Add CORs headers to every response (#62)
- change: Add Jason dependency for Elixir <= 1.17 (#90)
- change: Add default port to pg config if none set (#8)
- change: Add support for changeset shapes (#70)
- change: Add support for keyword-based sync_stream views (#95)
- change: Add support for optimistic writes (#14)
- change: Add transform function support to sync and sync_render (#99)
- …and 58 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
electric-sql/phoenix_sync was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 18 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit aaeaef7842a40e937c616504e61fb568fd28efc4 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-5d04157a340d.