Spindle - Type-safe web framework for modern OCaml 5
Show HN: Spindle – a full-featured, type-safe web framework for OCaml 5

Spindle is a full-featured web framework built for OCaml 5, bringing type safety to every layer of server development. It generates OpenAPI specs, Zod-style validation, and typed clients directly from your route definitions, so your server, native client, and Melange-compiled frontend can never disagree about paths or data shapes. Beyond REST, it covers WebSockets, server-sent streams, MCP resources with live subscriptions, OAuth 2.0 bearer token verification, and HTTP over Unix sockets. If you've wanted OCaml's rigor without hand-writing boilerplate, Spindle lets you define routes once and get everything else for free.
Spindle gains a third printer from the walk OpenAPI and Zod read, so the three cannot disagree: wiretype's module for every shape, a component named for the route, and a function per route over the browser's fetch.
- avsm
Nice work! Just looking through the Eio code, you may want to use the capability restrictions more. For example, in the static file serving code, you can use `Eio.Path.open_subtree` which will use Linux fd sandboxing to prevent accidental symlink escapes or other ways to leave that subtree: https://ocaml-multicore.github.io/eio/eio/Eio/Path/index.htm...
- B4uler5
Will keep an eye on this project, love me some Ocaml! Do you have an example of it deployed and in use?
Don’t like the “fresh off the AI block” feeling of the website but could be a bit more confident if I could see it used in the actual wild!
- andsoitis
Cool to see some Lisp in this OCaml project:
Add to your bin/dune:
(executable
(name main)
(libraries spindle eio_main)
(preprocess (pps ppx_wiretype)))**