Skip to content
CAI
Software that uses CAICheck a score

electric-sql/phoenix_sync

43.6

Weak · 15 November 2026

9.9k

lines of production code

Elixir

primary language

5

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

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 cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 41 → 44 (+2.9)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.

Lenses

  • Code Health 97 → 96 (-0.8)
  • Architecture 90 → 90 (+0.0)
  • Maturity 48 → 48 (+0.0)
  • Readiness 47 → 53 (+5.5)
  • Security 34 → 37 (+3.1)
  • Accessibility 34 → 38 (+4.1)

Resolved (6)

  • Leaked secret: high-entropy-secret (apps/phoenix_sync_example/config/dev.exs)
  • Leaked secret: high-entropy-secret (apps/phoenix_sync_example/config/test.exs)
  • Leaked secret: signing-key (apps/phoenix_sync_example/config/dev.exs)
  • Leaked secret: signing-key (apps/phoenix_sync_example/config/test.exs)
  • Leaked secret: signing-key (config/test.exs)
  • No ADRs found

New (40)

  • Edited copy of a member (13 corresponding lines) (lib/phoenix/sync/electric.ex)
  • Edited copy of a member (14 corresponding lines) (apps/txid_match/lib/txid_match/bumper.ex)
  • Edited copy of a member (14 corresponding lines) (lib/mix/tasks/phoenix_sync.install.ex)
  • Edited copy of a member (14 corresponding lines) (lib/phoenix/sync/sandbox/postgres/adapter.ex)
  • Edited copy of a member (21 corresponding lines) (lib/phoenix/sync/sandbox/postgres/adapter.ex)
  • Edited copy of a member (3 corresponding lines) (apps/phoenix_sync_example/lib/phoenix_sync_example_web/components/core_components.ex)
  • High CVE: [GHSA redacted] (apps/plug_sync/mix.lock)
  • High CVE: [GHSA redacted] (apps/txid_match/mix.lock)
  • High CVE: [GHSA redacted] (mix.lock)
  • High CVE: [GHSA redacted] (apps/plug_sync/mix.lock)
  • High CVE: [GHSA redacted] (apps/txid_match/mix.lock)
  • High CVE: [GHSA redacted] (mix.lock)
  • High CVE: [GHSA redacted] (apps/plug_sync/mix.lock)
  • High CVE: [GHSA redacted] (apps/txid_match/mix.lock)
  • High CVE: [GHSA redacted] (mix.lock)
  • High CVE: [GHSA redacted] (apps/plug_sync/mix.lock)
  • High CVE: [GHSA redacted] (mix.lock)
  • High CVE: [GHSA redacted] (apps/plug_sync/mix.lock)
  • High CVE: [GHSA redacted] (apps/txid_match/mix.lock)
  • High CVE: [GHSA redacted] (mix.lock)
  • …and 20 more

Written by cca.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 15 November 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.11.4 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-3c33c1882dc1.