Project Structure
- We use Clojure CLI /
deps.edn
-
src
is for source files, Clojure and ClojureScript or cljc - The main namespace has at least two segments, an org name and a project name, so
src/org_name/project_name.clj
- Optionally but recommended, use a reverse domain name for the org name, so you get a (at least) 3-segment name, e.g.
co.gaiwan.our-app
- This main namespace has a
-main
function that uses lambdaisland/cli - Other namespaces in the project are prefixed with the org+project name, e.g.
co.gaiwan.our-app.some-ns
, in other words all other source files go undersrc/org_name/project_name/
- The following will refer to
org-name.project-name
asprefix
-
resources
is for non-source files that should be accessible on the classpath - Avoid having files directly inside
resources
, especially with generic names (config.edn
,index.html
), because they could easily conflict with other stuff on the classpath. Useprefix
instead, e.g.resources/org_name/project_name/config.edn
-
prefix.config
requirescom.lambdaisland.config
, loads the config, sets theprefix
, and exposes it to the rest of the app by wrapping the access functions - Config follows the conventions as described in the lambdaisland/config README
Tooling
- We use babashka scripts where applicable
-
bb.edn
should include launchpad and/or lambdaisland/cli -
bin/dev
is where we create dev tasks, it's a bb script using li/cli -
bin/launchpad
is a WellKnownIdentifier that starts launchpad -
bin/kaocha
is a WellKnownIdentifier that runs tests -
*.local.*
and*.local
are gitignored (deps.local.edn
,config.local.edn
,.env.local
, etc)