Opinionated example project

February 10, 2025 ยท View on GitHub

Last used to bootstrap a Metosin project: 2024-11

Confidence level explanation:

  • Very high, high: I strongly believe this is the best choice nearly always
  • Medium: Should be a good choice, there could be cases where other choices are better
  • Low: I'm not sure if this is a good choice, but it solves something

Backend choices

Lib/featureConfidence levelComments
IntegrantVery high
ReititVery high
MalliVery high
Next.jdbcVery high
Honeysql v2HighCan be useful to generate dynamic SQL queries
HugSQLHighCan be useful when writing SQL by hand
hikari-cpHigh
Log4j2/LogbackMediumCurrent favorite is Log4j2. Logback is also great (and is used in most projects already,)
ring-jetty-adapterring/ring-jetty-adapter should be good now or http-kit?
Migratus/FlywayHighMigratus is a good choice. Flyway has been used in many projects so there might be more experience of using it at Metosin.
Java.timeHighNo need for joda-time
KaochaMediumKaocha for Clj test runner

Frontend choices

Lib/featureConfidence levelComments
UIxHighSimple React wrapper makes it easier to use modern React and libs
Re-frameMediumEven though Re-frame is for Reagent, it is usable with UIx and we have considerable experience using it
MUIMedium?One solution to writing styles inline in the Cljs components, seems to work relatively well with Cljs
IconsUse JS libs and svg files (for custom icons)
Reitit-frontendMedium?Good enough? It is used in most projects already.
MalliHighIf/when needed for FE route parameter validation or any other schema validations.
Date lib? Js-joda? Day-js or something?Medium?Moment is kind of old now. Closure Library is deprecated.
MAYBE: TanStack QueryLow? Medium?Useful abstraction for making calls to backend. Some challenges on using this together with Re-frame (and some with Cljs, but mostly solved.)
Test runnerMediumShadow-cljs can build unit test artifact, run in browser or with Karma
Async helpers: PromesaHighIF you need lots of async code, Promesa provides nice abstracting and helpers. Avoid core.async.

Open questions?

  • Forms
  • Alternative component libs, no experience. Both use Emotion like MUI? So similar sx props.
    • Chakra UI
    • Theme UI

Code style and tooling

Variants

Branches and pull requests can be used to provide some additional examples for cases we don't want to merge to the master branch. The diff should be kept as simple as possible, so it is easy to merge master changes back the branch.

Deployment

  • Create uberjar: bb build

  • Create docker image: docker build .

  • NOTE: Run uberjar with java -cp app.jar clojure.main -m backend.main

  • AOT compilation of the app code is not enabled, so backend.main class isn't available on the classpath