mtnygard / dawn

Fast start for a Clojure + Pedestal + Vase + Fern project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dawn

Fast start for a Clojure + Pedestal + Vase + Fern project

Fork this to your project, then fire up a Codespace to get started.

You'll probably want to change "dawn" to your project's name. Be sure to make the same change in deps.edn, shadow-cljs.edn and the various folder names.

Included in this starter

Embedded Components

Vase embedded here is a derivative work originally created as Vase. Vase was licensed under EPL v1.0. This fork is licensed under EPL-2.0

Starting a REPL with VS Code or Codespaces

These instructions are for a codespace using VS Code (either in a browser or running locally with a remote connection).

To get a Clojure REPL:

  1. Configure your .m2/settings.xml for access to download Datomic. (See below for instructions.)
  2. Click the nREPL badge in the status bar
  3. Select the "jack in" option
  4. For project type, select "Clojure CLI"
  5. Use the :dev alias

To get a CLJS REPL:

  1. Click the nREPL badge in the status bar.
  2. Select the "jack in" option
  3. For project type, select "shadow-cljs"
  4. Use :app for the build to start

Shadow-cljs will run an HTTP server at http://localhost:8020. To access this port, select the "Remote Explorer" tool from the left-hand navigation in your VS Code window. Under "Codespace Details" you will see "Forwarded Ports". Click "Port: 8020" to open a new tab connected to the shadow-cljs server.

To change this port number, modify forwardPorts in .devcontainer/devcontainer.json and the value at [:builds :app :dev-tools] in shadow-cljs.edn. After making this change, you must commit it, push it to your fork of Dawn, and start a new codespace.

Starting a REPL from command line

To get a Clojure REPL:

  1. Configure your .m2/settings.xml for access to download Datomic. (See below for instructions.)
  2. In a terminal, run clj -A:dev

To get a CLJS REPL:

  1. Ensure you have npx installed
  2. In a terminal, run npx shadow-cljs watch app

Your app will be on http://localhost:8020 and a Shadow CLJS dashboard (for monitoring builds) will be on http://localhost:9630

Staying Sane

If you want to merge upstream changes into your application in the future, then it's best not to change the code under framework/.

If you want to include other repositories as submodules, use the vendor/ directory and add a reference in deps.edn.

Of course, ordinary dependencies work just fine too.

dawn/src is the intended place for your application's code. You'll want to rename dawn to your app's name. Or just rename it to app... either way is fine.

Aliases

Clojure

  • :dev - Start a friendly REPL
  • :test - Run all tests

Shadow-CLJS

  • :app - Build the main application,

Fetching Datomic Client Jar

Vase depends on Datomic. You will need to set up ~/.clojure/deps.edn and ~/.m2/settings.xml according to the instructions at my.datomic.com in order to fetch the Datomic Pro jar file from repo.datomic.com.

Codespaces users will want to look at setting up personal dotfiles to make that easier.

If you do not want to use Datomic, remove both com.cognitect/vase and com.datomic/datomic-pro from deps.edn.

About

Fast start for a Clojure + Pedestal + Vase + Fern project

License:Eclipse Public License 2.0


Languages

Language:Clojure 97.9%Language:HTML 1.4%Language:Shell 0.4%Language:Dockerfile 0.3%Language:Emacs Lisp 0.0%Language:CSS 0.0%