This tutorial aims to guide readers familiar with OCaml along one course to a backend for a webapp. The app is lightweight in that it doesn’t take much code to define and in that it probably shouldn’t be used for any heavy, industrial applications.

The app implements two kinds of functionality:

An embellished echo server, responding to path parameters An interface to a rudimentary database of author excerpts

The tutorial covers the following topics:

Setting up and configuring the project

Routing requests (including POSTed form data)

Generating HTML dynamically

Interfacing with PostgreSQL

(The OCaml ecosystem also has great support for the frontend, thanks to Js_of_ocaml and Bucklescript , but we won’t be covering that here.)

Feedback, improvements, and corrections are most welcome!