Hacker News

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

27 points by zaiev ago | 7 comments
Spindle is a multicore-by-design, eio-native web framework for modern OCaml.

Its central idea is to provide an expressive, type-driven API and derive the rest: codecs, request validation, OpenAPI spec and frontend schemas (Zod and Melange). This keeps contracts in sync between server and client without maintaining separate definitions.

The framework includes an RFC-strict HTTP server, composable dependencies, WebSockets, SSE and high-level primitives for building MCP servers. It also provides production-ready essentials like distributed tracing, OT-compatible metrics, logging and other features you would expect. Speed was never the goal but the benchmarks show it running x2 faster than NestJS and x5 faster than FastAPI on a single core.

Give it a try.

Documentation: https://hyphatech.github.io/spindle/

B4uler5 |next [-]

Will keep an eye on this project, love me some Ocaml! Do you have an example deployment of it?

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 |next |previous [-]

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)))**

mpalmer |root |parent [-]

These are S-expressions, not Lisp. It's part of dune, which is the build system for ~40% of OPAM packages.

andsoitis |root |parent [-]

Dune is an unholy combination of bash and Lisp, according to its author - https://adam-mcdaniel.github.io/dune-website/

mpalmer |root |parent [-]

andsoitis |root |parent [-]

I stand corrected.

sroerick |previous [-]

Very cool! Congrats. Looking forward to trying