How suitable is OCaml for full stack web development?

Well if you want to do full stack development in OCaml you probably don’t want to add yet another language. So the “first and simplest” would rather be to use: js_of_ocaml which is a very stable and funded OCaml to JavaScript compiler closely following the latest compiler developments.

However if you don’t want to lose your time I’d personally advise to steer away from js_of_ocaml FFI and browser APIs and use brr instead which is an order of magnitude more ergonomic and documented. But I’m biased.

Also if you want to get an idea on how that could look like you can have a look here (though I’m not happy with all the way the code looks like there :-). This is a fully working and actively used application that closely matches the description of what you are after. It’s a basic CRUD app not using htmx but a derivative that tries to address some of its shortcomings, along with a little tiny bit of custom front end code. Though they will eventually be, not every library I’m using there is formally distributed yet, so you may have to use other components but it can give you an idea.

7 Likes