Simplest way to build a little web app? (i.e. which library to use?)

I have a library of functions dealing with songs & playlists (just metadata, no actual audio files) that exposes a bunch of functionality such as “get list of all songs”, “get list of songs filtered by P predicate”, “build a playlist of 10 songs starting from song X”, “get 5 songs that are compatible with song X” and so on…

I made a simple CLI app that calls into this library to provide basic functionality to the user. This is fine but this is can be inconvenient so I’d like to add a simple web UI that calls into the same library and allows the user to use a browser instead of the terminal.

Something very simple, like the user opens a browser on localhost and operate the program from there.

Can anybody recommend a good library to use for implementing the server? Since this is a learning exercise and I plan to keep it very simple, something easy to use and maybe with good docs would be appreciated.

PS: I have asked something similar a couple of years ago and got some suggestions, but things change fast so I hope I’m not bothering anyone by asking again :slight_smile:

I used Twain recently and was happy with it:

You can also use the more well-known scotty:

Seconding scotty, it’s great for small-scale stuff like this. You can start with the Hello World (or rather “scotty beam me up”) example and quickly build up from there. The types and documentation are mostly simple to follow, only thing I needed to wrap my head around for a bit was how to run a ScottyT app (the transformer version) with a custom monad, but you don’t necessarily need this.

I have used Twain in some of my web apps, particularly because I wanted a dead-simple framework, as my use-cases were very light.

Thanks all, going with Scotty for now, as it seems a bit more popular/established. Seems to do the job perfectly.

Very similar experience/requirement on my side project. Scotty was perfect!

I’m happily using twain with lucid for my small projects (calendar, wiki, blog-engine) - as a Haskell beginner.

I switched from Spock (with came from Scotty) to twain while trying to plug a memory leak, which turned out to be caused by the gzip and brotli wai middleware modules, or the way I was using them.