Home

Awesome

Electric Clojure – full-stack differential dataflow for UI

com.hyperfiddle/electric {:mvn/version "v3-alpha-SNAPSHOT"} · 2024 Oct 22

[!NOTE] Electric v3 is now in private beta! Request beta access here: https://www.hyperfiddle.net/early-access.html

Electric is a new way to build rich, interactive web products that simply have too much interactivity, realtime streaming, and too rich network connections to be able to write all the frontend/backend network plumbing by hand. With Electric, you can compose your client and server expressions directly (i.e. in the same function), and the Electric compiler macros will infer at compile time the implied frontend/backend boundary and generate the corresponding full-stack app.

Figure: In Electric, client and server expressions compose directly, and the Electric compiler transparently solves the network boundary through a straightforward dataflow graph analysis.

How it works: Unlike request/response frameworks, frontend ORMs, and client-side databases that suffer from request waterfalls, over/under fetching, large payload deserialization and other performance issues that get worse as your codebase and database grows, Electric uses a custom Clojure/Script compiler to perform deep graph analysis of your unified frontend/backend program and automatically determine the implied network cut, and then compile your program into separate client and server target programs that cooperate and anticipate each other's needs. See UIs are streaming DAGs (Getz 2022) for a quick 10 minute video explainer of how this works and why it actually doesn't result in the request waterfalls you might expect, even in the presence of deep nesting, loops and control flow.

Our mission is to raise the abstraction ceiling in web development in the same way that managed memory did in the 90s, paving the way for something new.

Hype quotes

Tutorial and live examples

Electric v2 readme, docs, tutorial links: https://github.com/hyperfiddle/electric/tree/v2

Documentation

Community

License