Explore Kotlin’s server-side capabilities and front-end interactivity with an ORM mapping layer and HTMX-powered views.
My previous article introduced Ktor and some of its basic features for building web applications. Now, we’ll expand the example application developed in that article by adding persistent data and HTMX, which will provide more interactive views. This gives us a setup with a lot of power in a relatively simple stack.
Please see the previous article for the example application code and setup. We’ll build on that example here.
Add persistence to the Ktor-HTMX application
The first step toward making our application more powerful is to add persistent data. The most popular way to interact with an SQL database in Kotlin is with the Exposed ORM framework. It gives us a couple of ways to interact with the database, using either a DAO mapping or a DSL. Kotlin’s native syntax means the overall feel of using the ORM mapping layer has less overhead than others you might have encountered.Explore IT Tech News for the latest advancements in Information Technology & insightful updates from industry experts!