{"id":18993436,"url":"https://github.com/hyperfiddle/electric-fiddle","last_synced_at":"2026-02-21T21:16:30.324Z","repository":{"id":213531042,"uuid":"666841812","full_name":"hyperfiddle/electric-fiddle","owner":"hyperfiddle","description":null,"archived":false,"fork":false,"pushed_at":"2026-02-13T14:43:21.000Z","size":2749,"stargazers_count":68,"open_issues_count":1,"forks_count":13,"subscribers_count":6,"default_branch":"main","last_synced_at":"2026-02-13T23:19:17.955Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hyperfiddle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-07-15T18:57:02.000Z","updated_at":"2026-02-13T14:45:58.000Z","dependencies_parsed_at":"2024-04-08T14:29:01.744Z","dependency_job_id":"33c607ea-2d48-43a1-b4f0-6b858260b70d","html_url":"https://github.com/hyperfiddle/electric-fiddle","commit_stats":null,"previous_names":["hyperfiddle/electric-fiddle"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hyperfiddle/electric-fiddle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperfiddle%2Felectric-fiddle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperfiddle%2Felectric-fiddle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperfiddle%2Felectric-fiddle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperfiddle%2Felectric-fiddle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperfiddle","download_url":"https://codeload.github.com/hyperfiddle/electric-fiddle/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperfiddle%2Felectric-fiddle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29694200,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T18:18:25.093Z","status":"ssl_error","status_checked_at":"2026-02-21T18:18:22.435Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T17:21:24.689Z","updated_at":"2026-02-21T21:16:30.286Z","avatar_url":"https://github.com/hyperfiddle.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Electric Fiddle (Electric v2)\n\nWe publish all our demos here in one place. This is how we fiddle around with our many demos at work.\n\nThis repo is structured to allow multiple \"fiddles\" (little apps) to run simultaneously on the same merged local dev classpath, with some common dev infrastructure (e.g. routing and example databases). Prod classpaths are isolated, so that each fiddle can be deployed individually and separately.\n\nThis is all done in a rather tiny amount of LOC, so we feel it is reasonable to expect you to understand it:\n\n* **local dev**: the [dev entrypoint](src-dev/dev.cljc) uses a [clever reader trick](src-dev/fiddles.cljc) to drive Clojure/Script namespace `:require` directives from a config file, [`electric-fiddle.edn`](electric-fiddle.edn).\n\n* **prod**: the [prod entrypoint](src-prod/prod.cljc) runs only one fiddle at a time, with an isolated classpath. Prod has a mandatory [build](src-build/build.clj), which bakes the Electric application client program. At compile time, both the electric user application version number (derived from git) and the fiddle entrypoint namespace are known statically, and built into both the client assets and also the server asset `resources/electric-manifest.edn`. At runtime, the prod entrypoint uses the reader trick to lookup the name of the entrypoint to run.\n\nFor a minimalist starter example, see https://github.com/hyperfiddle/electric-starter-app which is able to eliminate most of this dynamism by hardcoding the user application entrypoint and classpath.\n\n## Quick Start\n\nBegin with an example \"Hello World\" fiddle:\n\n```shell\n$ clj -A:dev\nINFO  dev: {:host \"0.0.0.0\", :port 8080, :resources-path \"public\", :manifest-path \"public/js/manifest.edn\"}\nINFO  dev: Starting Electric compiler and server...\nshadow-cljs - nREPL server started on port 9001\n[:dev] Configuring build.\n[:dev] Compiling ...\n[:dev] Build completed. (231 files, 2 compiled, 0 warnings, 2.46s)\nINFO  electric-fiddle.server-jetty: 👉 http://0.0.0.0:8080\n```\n\n1. Navigate to [http://localhost:8080](http://localhost:8080)\n2. Corresponding source code is in `src/hello_fiddle`\n\n## Load more fiddles\n\nIn [`electric-fiddle.edn`](electric-fiddle.edn), under `:loaded-fiddles`, add `electric-tutorial`:\n\n```diff\n {:loaded-fiddles [hello-fiddle\n+                  electric-tutorial ; requires :electric-tutorial alias and `npm install`\n                   ]\n }\n```\n\nRestart your REPL with the required dependencies:\n```shell\nnpm install\nclj -A:dev:electric-tutorial\n```\n\nNavigate to [http://localhost:8080](http://localhost:8080) (or refresh your browser tab). The pages shows a new entry for `electric-tutorial`.\n\n## Roll your own\n\n- `mkdir src/my_fiddle`\n- Add the following to `src/my_fiddle/fiddles.cljc`:\n```clojure\n(ns my-fiddle.fiddles\n  (:require [hyperfiddle.electric :as e]\n            [hyperfiddle.electric-dom2 :as dom]))\n\n(e/defn MyFiddle []\n  (e/client\n    (dom/h1 (dom/text \"Hello from my fiddle.\"))))\n\n(e/def fiddles ; Entries for the dev index\n  {`MyFiddle MyFiddle})\n\n(e/defn FiddleMain [ring-req] ; prod entrypoint\n  (e/server\n    (binding [e/http-request ring-req])\n      (e/client\n        (binding [dom/node js/document.body]\n          (MyFiddle.)))))\n```\n\n- Add `my-fiddle` to `electric-fiddle.edn` \u003e `:loaded-fiddles`.\n- add your dependencies to deps.edn (under an alias) and package.json\n- Restart your REPL with your new deps alias\n\n# Prod build\n\nDeploys one fiddle at a time.\n\n```shell\n# \"Hello World\" prod build\n\nclojure -X:build:prod build-client :hyperfiddle/domain hello-fiddle\nclojure -X:build:prod build-client :hyperfiddle/domain hello-fiddle :debug false :verbose false :optimize true\nclj -M:prod -m prod\n\n# With extra dependencies\n\nnpm install\nclojure -X:build:prod:electric-tutorial build-client :hyperfiddle/domain electric-tutorial\nclj -M:prod:electric-tutorial -m prod\n# http://localhost:8080/electric-tutorial.tutorial!%54utorial/electric-tutorial.demo-two-clocks!%54wo%43locks\n\n# Uberjar\n\nclojure -X:build:prod uberjar :hyperfiddle/domain hello-fiddle :build/jar-name \"app.jar\"\njava -cp app.jar clojure.main -m prod\n\n# Fly.io deployment\n\nfly deploy --remote-only --config src/hello_fiddle/fly.toml\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperfiddle%2Felectric-fiddle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperfiddle%2Felectric-fiddle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperfiddle%2Felectric-fiddle/lists"}