This HDA (Hypermedia Driven Application is inspired by combining todomvc (frontend and backend) and https://htmx.org.
While this is a small and simple app and I could have easily done away with some libraries or simplified the code organization and architecture of the project, I built it this way to experiment with the libraries and how to work with them in a modular way
- Very, very little javascript
- No JSON endpoints, just HTML (with htmx attributes)
- JVM Browser parallel testing (leveraging http4k and htmlunit)
While this is a small and simple app and I could have easily done away with some libraries or simplified the code organization and architecture of the project, I built it this way to experiment with the libraries and how to work with them in a modular way
I am using my own flavor of Hexagonal Architecture which separates the HTML endpoint code from the business logic and the database code. This makes trivial to change http servers or database code, even on the fly. i.e. I inject a fake repository implementation to allow for parallel testing. Another example is when I runned two servers side by side written in different libraries, see Previous Iterations at the end of this README.
- HTML String Generation:
- kotlinx-html: DSL that allows me to generate HTML strings in a strongly typed way
- Webjars: Allows me to pull npm libraries (todomvc css and htmx)
- htmx.js: Enhance HTML, reduce JavaScript I would have to write otherwise
- http4k: HTTP client/server library with a focus on "Server as a function" and dev experience
- koin: DI library
- Exposed: Database library with a focus on typesafe, portable queries
- sqlite-jdbc: embedded sqlite database and JDBC driver
- Testing:
- htmlunit: A headless browser that runs in the jvm with support for CSS and JS
While writting this project I tried different libraries, each of them may have their own use cases but I refrained to making branches for these because they weren't my preferred (or complete) implementation and I don't want to draw the focus too much away from the master branch.
Still here are some commits that reflect some of these previous iterations in chronological order: