A template webserver written in Haskell
Find a file Use this template
2026-01-03 19:20:37 -05:00
application Spruce things up a bit 2026-01-03 19:20:37 -05:00
database Spruce things up a bit 2026-01-03 19:20:37 -05:00
documentation Stripped, tested, ready 2025-09-17 00:07:13 -04:00
nix Spruce things up a bit 2026-01-03 19:20:37 -05:00
static Spruce things up a bit 2026-01-03 19:20:37 -05:00
.env.development Spruce things up a bit 2026-01-03 19:20:37 -05:00
.envrc Spruce things up a bit 2026-01-03 19:20:37 -05:00
.gitignore Spruce things up a bit 2026-01-03 19:20:37 -05:00
fourmolu.yaml Stripped, tested, ready 2025-09-17 00:07:13 -04:00
justfile Spruce things up a bit 2026-01-03 19:20:37 -05:00
mprocs.log Spruce things up a bit 2026-01-03 19:20:37 -05:00
mprocs.yaml Spruce things up a bit 2026-01-03 19:20:37 -05:00
README.md Spruce things up a bit 2026-01-03 19:20:37 -05:00
shell.nix Spruce things up a bit 2026-01-03 19:20:37 -05:00
sqitch.conf Stripped, tested, ready 2025-09-17 00:07:13 -04:00
stylish-haskell.yaml Stripped, tested, ready 2025-09-17 00:07:13 -04:00
webserver.cabal Spruce things up a bit 2026-01-03 19:20:37 -05:00

A template webserver for Haskell.

Tooling

  • Uses nix to manage nix developer environment, building, etc.
  • Uses podman to manage containerization.
  • Uses dotenvx to manage secure environment keys.
  • Uses sqitch to manage database upgrades.
  • Uses just for managing bash/amber commands.
  • Uses mprocs as a command runner host.

It also uses BulmaCSS. Explore a bit. Have fun with it.

Directory Structure

application/ <- The Haskell part
├ Webserver/
| ├ Control/ <- Typeclasses, "services", and non-datatype structure stuff
| ├ Data/ <- Datatypes and misc related
| ├ Routes/ <- Route organization, split off from Routes.hs and go here
| ├ Middlewares.hs <- Middleware handlers
| ├ Routes.hs <- Routes starting point
| └ Utils.hs <- Various utils
├ justfile <- just file
├ Main.hs <- Well, Main
└ Prelude.hs <- Overridden Prelude. Observe, augment, replace, whatever

database/ <- The sqitch/Postgres part
├ deploy/ <- Upgrading SQL
├ revert/ <- Downgrading SQL
├ verify/ <- Testing that revisions were successful
├ docker-compose.yml <- For running Postgres locally
├ Dockerfile <- For running Postgres locally
├ justfile <- just file
├ sqitch.plan <- sqitch file
└ uuid.txt <- The UID manager for the revision files. See the justfile above, the "migration" recipe

documentation/ <- Empty, but intended for use for documenting things

nix/ <- Nix stuff

static/ <- Statically served assets. HTML, CSS, Javascript, images, etc.

The rest is configuration files and stuff you can figure out, hopefully.

Getting Started

  • Get familiar with the tools I've outlined.
  • Optional: Change all references to "Webserver" and "webserver" to whatever your application's name will be before running anything the first time. Can be done later, you'll just need to change the database stuff.
  • You don't need nix, but everything that's used here is already in there. So if you decide not to use devenv, make sure you install/handle all the parts you need yourself.
  • You'll need to get dotenvx situated. It needs to make a .env.keys file for you, and also put the public key value in .env.development.
    • When you get more situated, also make a .env.production, so you can differentiate values and stuff
    • If development/production file differentiation doesn't matter to you, make just a .env file and just use that. Be sure to change references to .env.development
  • just db start or just db run will get initial Postgres stuff set up for you locally if you used that. Otherwise, you'll need to set that up yourself
  • After (and while) Postgres is running, you need to run just db migrate to invoke sqitch to apply the two current migrations
  • While Postgres is running, run the app with just app run.