Home

Awesome

Electric Starter App

A minimal Electric Clojure app, and instructions on how to integrate it into an existing app. For more demos and examples, see Electric Fiddle.

Instructions

Dev build:

Prod build:

clj -X:build:prod build-client
clj -M:prod -m prod

Uberjar (optional):

clj -X:build:prod uberjar :build/jar-name "target/app.jar"
java -cp target/app.jar clojure.main -m prod

Deployment example:

Integrate it in an existing clojure app

  1. Look at src-prod/prod.cljc. It contains:
    • server entrypoint
    • client entrypoint
    • necessary configuration
  2. Look at src/electric_starter_app/server_jetty.clj. It contains:
    • an example Jetty integration
    • required ring middlewares

Build documentation

Electric Clojure programs compile down to separate client and server target programs, which are compiled from the same Electric application source code.

Consequently, you need robust cache invalidation in prod!