Skip to content

hyperfiddle/electric3-starter-app

Repository files navigation

Electric v3 Starter App

Links

Getting started - dev setup

  • Shell: clj -A:dev -X dev/-main.
  • Login instructions will be printed
  • REPL: :dev deps alias, (dev/-main) at the REPL to start dev build
  • App will start on http://localhost:8080
  • Electric root function: src/electric_starter_app/main.cljc
  • Hot code reloading works: edit -> save -> see app reload in browser

Warning

Electric dev environments must run one single JVM that is shared by both the Clojure REPL and shadow-cljs ClojureScript compilation process! Electric uses a custom hot code reloading strategy to ensure that the Electric frontend and backend processes (DAGs) stay in sync as you change one or the other. This starter repo achieves this by booting shadow from the dev entrypointsrc-dev/dev.cljc. I believe this is compatible with both Calva and Cursive's "happy path" shadow-cljs support. For other editors, watch out as your boot sequence may run shadow-cljs in a second process! You will experience undefined behavior.

Deployment

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

# Uberjar (optional)
clj -X:build:prod uberjar :build/jar-name "app.jar"
java -cp target/app.jar clojure.main -m prod

# Docker
docker build --build-arg VERSION=$(git rev-parse HEAD) -t electric3-starter-app:latest .
docker run --rm -it -p 8080:8080 electric3-starter-app:latest

# Fly
fly deploy --remote-only --build-arg VERSION=$(git rev-parse HEAD)

License

Electric v3 is free for bootstrappers and non-commercial use, and otherwise available commercially under a business source available license, see: Electric v3 license change (2024 Oct). License activation is experimentally implemented through the Electric compiler, requiring compile-time login for dev builds only. That means: no license check at runtime, no login in prod builds, CI/CD etc, no licensing code even on the classpath at runtime. This is experimental, but seems to be working great so far. We do not currently require any account approval steps, just log in. There will be a EULA at some point once we finalize the non-commercial license, for now we are focused on enterprise deals which are different.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •