whatisgithub

What is electric-circuits?

electric-sql/electric-circuits — explained in plain English

Analysis updated 2026-07-25

16RustAudience · developerComplexity · 4/5Setup · moderate

In one sentence

Electric Circuits makes database queries live so results update automatically when data changes. You write normal SQL queries against Postgres and get a continuous stream of updates instead of polling.

Mindmap

mindmap
  root((repo))
    What it does
      Live query results
      No polling needed
      Incremental updates
    Tech stack
      Rust
      Postgres
      DBSP
    Use cases
      Live UI dashboards
      Infinite scrolling
      Live aggregations
    How it works
      Processes only changes
      No stored table copies
      Three message types
    Audience
      Backend developers
      Real-time app builders

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Build a live dashboard that updates instantly when database rows change.

USE CASE 2

Create infinite scrolling lists with live updates as new data arrives.

USE CASE 3

Sync live query results to a local collection for offline-aware apps.

USE CASE 4

Feed continuously updating query results to an automated agent.

What is it built with?

RustPostgresDBSP

How does it compare?

electric-sql/electric-circuitsbcallender/agent-context-workshopcelestia-island/ratatui-markdown
Stars161616
LanguageRustRustRust
Setup difficultymoderatemoderateeasy
Complexity4/54/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires a Postgres database and familiarity with the Electric protocol, though a local demo boots its own temporary database.

The license is not specified in the available documentation, so check the repository for details.

So what is it?

Electric Circuits is a tool that makes database queries "live," meaning their results update automatically whenever the underlying data changes. You write normal database queries, the kind your application already uses for joins, filtering, and subqueries. Instead of your app constantly polling or refetching data, every query result becomes a live stream. You can bind it to a user interface component, sync it to a local collection, or feed it to an automated agent. Your application writes data to Postgres using ordinary SQL, and a separate engine keeps every query result in sync as changes happen. A live query works by sending you the current matching rows first, then a continuous feed of updates. The feed sends one of three messages: a row was added or changed, a row was removed, or nothing, meaning a change elsewhere did not affect this particular query. Only the matching rows and columns travel across the network, so the local copy on the client is always exactly the query result. There is never a stale cache to clear or refresh. The engine is built in Rust on top of a library called DBSP, which handles incremental computation. When a row changes, the engine processes only the difference, not the entire dataset. It represents changes as signed values, where an insert is a positive one and a delete is a negative one. This means keeping a result up to date never requires running the full query again. The cost depends on the size of the change, not the size of the table. The engine keeps no copy of any table, and memory scales with the number of query types your app runs, not with the amount of data stored. The system connects to Postgres, which remains the source of truth. Changes flow from Postgres through a log into the engine, which maintains shared data pipelines called circuits. The engine provides two ways for clients to connect: the standard Electric protocol, and an extended client that adds ordered pages for infinite scrolling and live aggregations like counts and sums. You can try it locally with a demo that boots its own temporary database and a visual pipeline explorer. The full README is longer than what was shown.

Copy-paste prompts

Prompt 1
Using Electric Circuits, write a live query that streams all active users from Postgres and logs every insert, update, and delete to the console.
Prompt 2
Set up Electric Circuits with a local Postgres database and create a live query for a chat messages table that updates in real time.
Prompt 3
Build an infinite scrolling list using Electric Circuits extended client that loads pages of orders and stays live as new orders arrive.
Prompt 4
Create a live aggregation with Electric Circuits that shows a continuously updating count and sum of sales from a Postgres table.
Prompt 5
Compare Electric Circuits live queries to traditional polling, write a demo that shows the difference in update latency and network usage.

Frequently asked questions

What is electric-circuits?

Electric Circuits makes database queries live so results update automatically when data changes. You write normal SQL queries against Postgres and get a continuous stream of updates instead of polling.

What language is electric-circuits written in?

Mainly Rust. The stack also includes Rust, Postgres, DBSP.

What license does electric-circuits use?

The license is not specified in the available documentation, so check the repository for details.

How hard is electric-circuits to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is electric-circuits for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.