{"id":13609257,"url":"https://github.com/day8/re-frame-template","last_synced_at":"2025-05-15T09:08:01.231Z","repository":{"id":28067240,"uuid":"31564230","full_name":"day8/re-frame-template","owner":"day8","description":"A Leiningen template for creating a re-frame application (client only) with a shadow-cljs build.","archived":false,"fork":false,"pushed_at":"2025-02-18T22:51:22.000Z","size":1272,"stargazers_count":593,"open_issues_count":0,"forks_count":89,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-05-12T02:41:02.629Z","etag":null,"topics":["cider","cljs-devtools","clojurescript","re-frame","reagent","shadow-cljs"],"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/day8.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"mike-thompson-day8"}},"created_at":"2015-03-02T21:30:15.000Z","updated_at":"2025-05-11T12:19:11.000Z","dependencies_parsed_at":"2024-04-27T11:41:50.207Z","dependency_job_id":"9487149c-618c-4f3f-8563-6227383f1720","html_url":"https://github.com/day8/re-frame-template","commit_stats":{"total_commits":620,"total_committers":54,"mean_commits":"11.481481481481481","dds":0.3951612903225806,"last_synced_commit":"6e6e26d17474054c10f2154579168f35e6b87e53"},"previous_names":[],"tags_count":109,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/day8%2Fre-frame-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/day8%2Fre-frame-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/day8%2Fre-frame-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/day8%2Fre-frame-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/day8","download_url":"https://codeload.github.com/day8/re-frame-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254310520,"owners_count":22049470,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cider","cljs-devtools","clojurescript","re-frame","reagent","shadow-cljs"],"created_at":"2024-08-01T19:01:33.622Z","updated_at":"2025-05-15T09:08:01.198Z","avatar_url":"https://github.com/day8.png","language":"Clojure","funding_links":["https://github.com/sponsors/mike-thompson-day8"],"categories":["Clojure"],"sub_categories":[],"readme":"\u003c!-- [![CI](https://github.com/day8/re-frame-template/workflows/ci/badge.svg)](https://github.com/day8/re-frame-template/actions?workflow=ci)\n[![CD](https://github.com/day8/re-frame-template/workflows/cd/badge.svg)](https://github.com/day8/re-frame-template/actions?workflow=cd)\n[![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/day8/re-frame-template?style=flat)](https://github.com/day8/re-frame-template/tags) \n[![GitHub pull requests](https://img.shields.io/github/issues-pr/day8/re-frame-template?style=for-the-badge\u0026logo=github)](https://github.com/day8/re-frame-template/pulls)\n\n--\u003e\n[![Clojars Project](https://img.shields.io/clojars/v/re-frame/lein-template?style=for-the-badge\u0026logo=clojure\u0026logoColor=fff)](https://clojars.org/re-frame/lein-template)\n[![GitHub issues](https://img.shields.io/github/issues-raw/day8/re-frame-template?style=for-the-badge\u0026logo=github)](https://github.com/day8/re-frame-template/issues)\n[![GitHub](https://img.shields.io/github/license/day8/re-frame-template?style=for-the-badge)](https://github.com/day8/re-frame-template/blob/master/LICENSE)\n\n# re-frame-template\n\nThis is a `Leiningen` template for creating a [re-frame](https://github.com/day8/re-frame) application scaffold (client only)\nwith a [shadow-cljs](https://shadow-cljs.github.io/docs/UsersGuide.html) build.  \nIt will take you 60 seconds to create your first re-frame app and start to edit it.\n\n\n\nYou can pick and choose what \"extras\" you'd like included into the scaffold - \"extras\" like libraries to do routing, debugging and CSS.\n\n## Before You Start\n\nYou'll need to install `Leiningen` (a build tool) by following [these instructions](https://purelyfunctional.tv/guide/how-to-install-clojure/).\n\nYou'll also need [Node.js](https://nodejs.org/en/download/).\n\n## Basic Usage\n\nThe base template includes:\n\n* [re-frame](https://github.com/day8/re-frame)\n* [shadow-cljs](https://shadow-cljs.github.io/docs/UsersGuide.html)\n* [cljs-devtools](https://github.com/binaryage/cljs-devtools)\n\nTo create an application with just the base template, use this commandline:\n```sh\n$ lein new re-frame \u003capp-name\u003e\n```\nWhen using this command, you'll need to substitute in your own `\u003capp-name\u003e` - perhaps `my-killer-app` or `an-early-masterpiece`.\n\n\u003e **Troubleshooting note:** for `\u003capp-name\u003e` don't use `cljs`. That name will confuse the compiler (long story) and you will later see errors like `cljs.core.init is not a function`.\n\n## Extras\n\nThe following \"extras\" can be nominated on the commandline when you create the template:\n\n* CSS\n  * [garden](https://github.com/noprompt/garden) with [spade](https://github.com/dhleong/spade) (`+garden`)\n* Debug\n  * [re-frame-10x](https://github.com/day8/re-frame-10x) (`+10x`)\n  * [re-frisk](https://github.com/flexsurfer/re-frisk) (`+re-frisk`)\n* Development\n  * [cider](https://github.com/clojure-emacs/cider) (`+cider`)\n  * [clj-kondo](https://github.com/borkdude/clj-kondo) (`+kondo`)\n  * [cljs.test](https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/test.cljs) (`+test`)\n  * [git-inject](https://github.com/day8/shadow-git-inject) (`+git-inject`)\n* Misc.\n  * [re-com](https://github.com/day8/re-com) (`+re-com`)\n  * [re-pressed](https://github.com/gadfly361/re-pressed) (`+re-pressed`)\n  * [breaking-point](https://github.com/gadfly361/breaking-point) (`+breaking-point`)\n  * [github-actions](https://github.com/features/actions) (`+github-actions`)\n* Routing\n  * [bidi](https://github.com/juxt/bidi) and [pushy](https://github.com/clj-commons/pushy) (`+routes`)\n\nTo add an `extra` to the base template, append its name to the commandline, with a leading `+`. Here's an example of adding `re-com`:\n\n```\nlein new re-frame \u003capp-name\u003e +re-com\n```\nNote: it is `+re-com`, not just `re-com`.\n\nAny combination of `extras` can be added at once:\n\n```\nlein new re-frame \u003capp-name\u003e +garden +re-com +routes +test +10x\n```\n\n\u003e  Note: to assist debugging, you'll want to include either `+10x` or `+re-frisk`\n\n## Start Cider from Emacs (if using +cider):\n\nRefer to the [shadow-cljs Emacs / CIDER documentation](https://shadow-cljs.github.io/docs/UsersGuide.html#cider).\n\nThe mentioned `dir-local.el` file is created by this template.\n\n## Connect Calva from VS Code:\n\n[Calva](https://github.com/BetterThanTomorrow/calva) has built-in support for `shadow-cljs` projects (that's why there is no `+calva` option for creating this project). \n\n0. `npm install`\n1. From VS Code, issue the command **Calva: Start a Project REPL and Connect (a.k.a Jack-in)**, `ctrl+alt+c ctrl+alt+j`.\n   * Calva will auto-detect that this is a `shadow-cljs` project and ask for which build to compile.\n   * Calva's output window will open and log some progress information.\n1. When prompted for which build to start, select `:app`.\n   * `:app` is the only configured build, but the VS Code menu for this is a bit strange so _make sure the `:app` checkbox is really ticked before proceeding_.\n   * This will start the app, so in this workflow you don't do the **Run application** steps outlined below.\n1. When prompted for which build to connect to, select `:app`.\n    * In the **View** menu of VS Code, you can tell it to show the **Terminal** view, where you see which command the jack-in process is started with, and it's output. `Ctrl+C` in this pane will kill your app and free up all resources it has allocated.\n1. When the app is compiled\n    1. Open http://localhost:8280 in your browser.\n    1. Confirm that it says *Hello from re-frame*. (Depending on how long the app takes to compile, you might need to reload the page a few times.)\n1. Open the `views.cljs` file from `src/\u003cyour-project-name\u003e` and issue **Calva: Load Current File and Dependencies**. `ctrl+alt+c enter`.\n    1. Confirm that you are connected by adding evaluating `(js/alert \"Hello from Calva\")` (`alt+enter` and `ctrl+enter` are your friends).\n    1. Confirm that Shadow is hot reloading by changing the greeting message.\n\n\nSee https://calva.io for more on how to use Calva.\n\n\n## Run application:\n\n```sh\nnpm install\nnpm run watch\n```\n\nor\n\n```sh\nnpm install\nnpx shadow-cljs watch app browser-test karma-test\n```\n\nWait a bit, perhaps 20 seconds, keeping an eye out for a sign the compile has finished, then browse to [http://localhost:8280](http://localhost:8280).\n\nTo see the other available `shadow-cljs` commands run:\n```\nnpx shadow-cljs --help\n```\n\n## Setting Up Your Browser\n\nSo, you now have the application running.\n\nBefore you start developing, you should tweak two settings within your\nbrowser's `devtools`. These are one-time actions (for each browser and laptop you use).\nI'll assume Chrome for the purposes of further explanation:\n\n1. Open devtools. Press press `F12` or `Ctrl-Shift-i` ([actually there's a variety of ways](https://developer.chrome.com/devtools))\n1. Open the devtools \"Settings\" panel. Press F1. (Careful. Not the settings panel for Chrome itself!! The settings panel for devtools)\n1. Under the \"Network\" heading, tick the option \"Disable cache (while DevTools is open)\". You don't want shadow-clj's attempts at reloading to be defeated by caching.\n1. Under the \"Console\" heading, tick the option \"Enable custom formatters\". This allows [cljs-devtools](https://github.com/binaryage/cljs-devtools) to perform its magic.\n1. Close Settings. Close Devtools.\n1. Reopen Devtools\n\n![settings](docs/images/devtools-settings.png)\n\n## Open 10x Panel (if using +10x):\n\nTo use `re-frame-10x` for debugging your app:\n  1. click on the application, minimal through it is, to give it \"input focus\" (you want to be sure that any key presses are going to your new app)\n  2. press `Ctrl-Shift-X` and you should see the `re-frame-10x` panel appear on the right side of the window\n\nSometimes achieving Step 1 on a really simple app - one without widgets - can be fiddly,\nbecause the browser itself hogs \"input focus\" and grabs all the keystrokes (like `Ctrl-Shift-X`) which don't\nthen make it through to your app. You may need to be determined and creative with Step 1.\nI have every confidence in you.\n\n## Hot Reloading Is Now Go\n\nIf you now edit files, shadow-cljs will automatically\nrecompile your changes and \"hot load\" them into your running app, without your app needing\nto be re-started. The resulting fast, iterative workflow tends to make you very productive, and\nis cherished by those lucky enough to experience it.\n\nStart by editing this file: `/src/cljs/\u003capp-name\u003e/views.cljs`.\n\n### debug?:\n\nIn the namespace _app-name.config_, there is a var called `debug?`, which defaults to\n_true_ in the `dev` build, and _false_ in the `prod` build.\n\nIf, for example, you wrap your `println`s with a `when` block as shown below,\nthen you will get logs printed to the browser's console for the `dev` build and\nnot the `prod` build.\n\n```clojure\n(when config/debug?\n  (println \"dev mode\"))\n```\n\n## Run tests (if using +test):\n\nRun your tests\n\n```\nnpm install\nnpm run watch\n```\n\nAnd in another terminal:\n```\nkarma start\n```\n\n## GitHub Actions\n\nAfter a push, head to the actions section of GitHub repo to see the pipeline processing.\n\n\n## Production Build\n\nTo compile clojurescript to javascript:\n\n```sh\nnpm run release\n```\n\n## How to Add Dependencies\n\nYour new application is built by a tool chain controlled by [shadow-cljs](http://shadow-cljs.org/) (a modern CLJS compiler).\n\nThere are two files of interest:\n  -  `shadow-cljs.edn` - edit this file if you want to add Clojure and ClojureScript dependency as [you would for a normal\nLeiningen project](https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md#dependencies).\n  - `package.json` - edit this file if you want to add a JavaScript and NPM dependency.\n\n## Other Templates\n\n* [chestnut](https://github.com/plexus/chestnut)\n* [luminus](https://github.com/luminus-framework/luminus-template)  (full stack)\n* [reagent-figwheel](https://github.com/gadfly361/reagent-figwheel)\n* [reagent-seed](https://github.com/gadfly361/reagent-seed)\n\n## Backend Options\n\nThis template does NOT include a backend. You may want to look at the following for backend options:\n\n* [ring](https://github.com/ring-clojure/ring) and [liberator](http://clojure-liberator.github.io/liberator/)\n* [duct](https://github.com/duct-framework/duct)\n* [yada](https://github.com/juxt/yada)\n* [pedestal](https://github.com/pedestal/pedestal) and [vase](https://github.com/cognitect-labs/vase)\n\n## More re-frame\n\nLooking for more re-frame inspiration, templates or example applications?\nSee the [external resources](https://github.com/day8/re-frame/blob/master/docs/External-Resources.md) docs page.\n\n## Contributing\n\nContributions are welcomed!  To add a new profile, this is what I'd recommend:\n\n1. Add a file with the name of the profile [here](https://github.com/day8/re-frame-template/tree/master/src/leiningen/new/options)\n2. Look at the existing options in that folder for inspiration for what to include in that file\n3. Update [re_frame.clj](https://github.com/day8/re-frame-template/blob/master/src/leiningen/new/re_frame.clj) with the profile\n4. Add any new files [here](https://github.com/day8/re-frame-template/tree/master/src/leiningen/new/re_frame) and use the {{ var-name }} syntax as needed\n5. Update the [README](https://github.com/day8/re-frame-template/tree/master/src/leiningen/new/re_frame) that will result when the template is used, as well as the top-level [README](https://github.com/day8/re-frame-template/blob/master/README.md) for re-frame-template itself\n6. In a terminal, at the root of re-frame-template, run `lein install`\n7. Locally test that your profile works, `lein new re-frame \u003capp-name\u003e +\u003cprofile-name\u003e`\n8. Add your profile to [create-templates](https://github.com/day8/re-frame-template/blob/master/create-templates.sh) and run the script to make sure the other profiles didn't break.\n\n## License\n\n```\nThe MIT License (MIT)\n\nCopyright © 2015-2018 Matthew Jaoudi\nCopyright © 2015 Dylan Paris\nCopyright © 2015 Michael Thompson\nCopyright © 2015 Markku Rontu\nCopyright © 2016 Daniel Compton\nCopyright © 2019-2021 Isaac Johnston\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fday8%2Fre-frame-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fday8%2Fre-frame-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fday8%2Fre-frame-template/lists"}