A bulletin board website using Haskell, scotty and friends- 2021-01-15 -
tl;dr: I've built a bulletin-board website app - source code / video demo.
After writing my blog post on building a bulletin board, I decided spend a couple of weeks and build something a bit more featureful to serve as an example of doing something a bit more complex with scotty.
The result of my work is bulletin-app.
It includes user management (registration, auth, sessions, invites, profiles, etc), post editing, comments, basic mod tools and more.
The main Haskell libraries I've used in this project are:
- scotty for web routing and actions
- lucid for html
- persistent and persistent-sqlite for the database and model
- stm for the in memory session store
- cookie and clientsession for the cookies
- password (Using the bcrypt algorithm) for storing password hashes
- cheapskate and cheapskate-lucid for markdown parsing and conversion to html
- optparse-generic for command line options parser.
bulletin-app might not be the most impressive forum software out there, but I had fun building it and I'm happy with the result. I especially like the fact that it's standalone and does not require any other software or dependencies to run. Just download the statically linked executable (if you're on linux), and run it. Like this:
Download and unpack with these commands:
wget https://gitlab.com/gilmi/bulletin-app/uploads/e8da43d63b065d2104e3b271927db0b4/bulletin-board-0.2.0.1_linux_musl.tar.gz tar xzvf bulletin-board-0.2.0.1_linux_musl.tar.gz cd bulletin-board
Run it using this command:
REGISTRATION='OpenRegistration' VISIBLE='Public' PORT=8080 SCOTTY_ENV='Development' CONN_STRING='file:/tmp/bullet.db' ./bulletin-app serve
And visit http://localhost:8080. That's it!
I've also made a video demonstrating the website on youtube.
I hope this example will be useful for others who'd like to try and build similar websites in Haskell :)