REPL Workflow
Most Clojure devs work with the REPL through a reloadable lifecycle system. If you don't know what a REPL workflow is I mandate that you read through REPL Driven Development and watch all the associated videos.
This document goes into more details about personalizing the REPL workflow to your needs using launchpad.
Prerequisites
If you haven't already, please follow the steps from getting started documentation to have everything running.
Understanding Launchpad
ShipClojure uses lambdaisland/launchpad to manage the development environment. When you run bb dev, launchpad:
Installs development tools via mise
Installs npm dependencies
Sets up secrets file if missing
Starts Docker services (PostgreSQL)
Starts CSS watch process
Starts the Clojure REPL on port
7888Automatically calls
(user/go)to boot the system
The beauty of launchpad is that it handles all this automatically, but also allows you to personalize your setup without affecting other team members.
Personalizing Your Setup
Launchpad supports a deps.local.edn file for individual configuration. This file is gitignored, so your preferences stay local to your machine.
Create a deps.local.edn file in the project root:
Editor-Specific Setup
Emacs / CIDER
For the smoothest Emacs experience, add this to your deps.local.edn:
The --emacs flag is shorthand for --cider-nrepl --refactor-nrepl --cider-connect, which:
Injects CIDER nREPL middleware
Injects refactor-nrepl middleware
Automatically instructs Emacs to connect to the REPL
With this setup, just run bb dev and Emacs will automatically connect.
VS Code / Calva
For VS Code/Calva users, add this to your deps.local.edn:
The --vs-code flag includes the CIDER nREPL middleware that Calva needs.
Then run bb dev and connect in VS Code:
Open the Command Palette (
Ctrl+Shift+P/Cmd+Shift+P)Run
Calva: Connect to a Running REPL Server in the ProjectSelect
deps.ednEnter
localhost:7888when prompted
IntelliJ / Cursive
Run bb dev to start the REPL, then in IntelliJ:
Go to
Run > Edit ConfigurationsAdd a new
Clojure REPL > RemoteSet host to
localhostand port to7888Run the configuration
Vim / Neovim
Run bb dev to start the REPL, then connect using your preferred plugin (vim-fireplace, conjure, etc.) to localhost:7888.
Working with the REPL
Once connected, the system should already be running (launchpad calls (user/go) automatically). You can interact with it using these functions from the user namespace:
Pro tip: Bind (user/reset) to a keybind so you can call it often. See this tweet for community explanations of binding a key to a clojure fn call - people in the replies contributed with the way to do it for most editors.
ClojureScript REPL
NOTE: You don't need a CLJS REPL to work on ShipClojure. Live reload of changes in
.cljsor.cljcfiles are automatically compiled and reflected in the browser. The CLJS REPL is a nice-to-have for those who prefer it.
The shadow-cljs nREPL server runs on port 7002. You can change this in shadow-cljs.edn under [:nrepl :port].
Connecting to ClojureScript REPL
Alternatively, connect directly to the shadow-cljs nREPL:
Emacs:
M-x cider-connect-cljand enterlocalhost:7002VS Code:
Calva: Connect to Running REPL, selectGeneric, enterlocalhost:7002IntelliJ: Create a Remote REPL configuration for
localhost:7002
Then call (user/cljs-repl) to switch to the ClojureScript REPL.
Customizing What Launchpad Starts
Shadow-CLJS Builds
By default, launchpad starts shadow-cljs builds configured via the :launchpad/shadow-build-ids key in the :dev alias. If you want to customize which builds start, add to your deps.local.edn:
Disabling Automatic System Start
If you prefer to manually call (go) instead of having it run automatically, you would need to modify bin/launchpad and set :go false. However, this affects everyone, so it's recommended to keep :go true and use (halt) if you need to stop the system.
Hot Reloading deps.edn
One of launchpad's killer features is hot-reloading of deps.edn and deps.local.edn. You can:
Add new dependencies
Switch to a newer version of a dependency
Switch from a Maven jar to a local checkout (
:local/root)Activate additional aliases
All without restarting your REPL! Just save your deps.edn or deps.local.edn and launchpad will pick up the changes.
Troubleshooting
System didn't start automatically
If the system didn't start, you can manually start it:
Need to fully reset
If things get into a weird state:
Port already in use
If port 7888 is already in use, either stop the existing process or configure a different port in deps.local.edn:
Last updated