Beautiful and idiomatic
Expressive and composable, doing the heavy lifting in just a few lines of readable code.
Fast, ergonomic and RFC-strict. Eio-native and multicore by design.
opam repo add open-opam https://github.com/open-opam/opam-repository.gitopam install spindleopen Spindle.Syntax
type greeting = { text : string } [@@deriving wiretype]
let hello name = Ok { text = "Hello, " ^ name ^ "!" }let name = Spindle.Path.string "name"
let routes = [ Spindle.get Spindle.Path.(s "hello" / name) (Spindle.Returns.json greeting_json) (let+ name = Spindle.param name in hello name); ]
let () = Spindle.Log.setup (); Eio_main.run @@ fun env -> Spindle.serve env (routes @ Spindle.Openapi.routes routes)Expressive and composable, doing the heavy lifting in just a few lines of readable code.
Multicore by design, with domains putting every core to work serving connections in parallel.
OCaml 5 effects give every connection its own fiber and keep handlers in plain direct style.
Interactive API docs generated from the routes, so they are never out of date.
Zod or Melange schemas generated from the routes, keeping client and server aligned.
JSON contracts derived from OCaml types, bounds and docs included.
Built for speed and safety, and extensively tested against RFC standards.
Extend any route with injectable logic and resources that compose and swap easily.
WebSockets, SSE, sessions, rate limits, logs, traces and OpenTelemetry metrics.