Skip to content

Demo of a restartable back-end in the REPL + hot-reloadable front-end in the browser.

Notifications You must be signed in to change notification settings

Hendrick/holygrail

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Holy grail

Well, on second thought, let’s not go to Camelot – it is a silly place. — King Arthur

What is it?

This demonstrates the holy grail workflow for web development the way I envision it: an auto-restartable back-end in the REPL + a hot-reloadable front-end in the browser.

This workflow is built on top of Boot, a build tool, and system, a component library.

Requirements

  1. `boot`
  2. Datomic

Installation

Clone this repo, `cd` into it, and start the development pipeline build.

$ git clone git@github.com:Hendrick/holygrail.git
$ cd holygrail
$ boot dev

Testing

To test:

$ boot test

What’s Happening

`boot dev` runs the following tasks:

  1. Sets up environment variables with `environ`
  2. Creates a file watcher
  3. Creates a `dev-system` that reloads when `handler.clj` changes
  4. Sets up to reload when you change a `cljs` file
  5. Sets up `cljs` compliation
  6. Sets up a REPL
  7. Ensures that your Datomic schema is transacted
  8. Seeds your Datomic database

Things TODO

  • Task to autodownload Datomic if it’s not installed locally?
  • Investigate option to not seed on every change
  • Use datascript for client-side
  • Add devcards!

Principle of operation

Manual

You want to operate with a REPL, start the system, and reset it when you make changes.

Compose a build pipeline:

(deftask dev
  "Run a restartable system in the Repl"
  []
  (comp
   (environ :env {:http-port 3000})
   (watch)
   (system :sys #'dev-system)
   (reload)
   (cljs)
   (repl :server true)))

Start it:

$ boot dev

Pay attention to the line that says:

nREPL server started on port 49722 on host 127.0.0.1 - nrepl://127.0.0.1:49722

Launch your favorite editor, and connect to the headless REPL (M-x cider-connect in Emacs works great). Then type:

(go)

Your web app is started and listening at http://localhost:3000. When you make changes that require a system restart, type in the REPL:

(reset)

Automatic

The boot-system task allows you to automate all of the above.

(system :sys #'dev-system :auto-start true :hot-reload true :files ["handler.clj"])

The auto-start option takes care of starting the app the first time. Your system will automatically be reset after editing handler.clj. Changes elsewhere do not require a system restart, and are available via namespace reloading everytime you save your work.

Note: The build.boot in this repo already contains those options.

Demo

A demo video that tries to demonstrate how developing for the web can be a liberating and seamless experience.

Holy Grail demo

Do you feel the creative juices flow? Are you ready for endless hours of sheer creative output?

About

Demo of a restartable back-end in the REPL + hot-reloadable front-end in the browser.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Clojure 96.6%
  • HTML 2.5%
  • CSS 0.9%