Bonsai: Janestreet's UI Library
Points and comments are a snapshot, not live.
Jane Street releases Bonsai, an OCaml UI library for reactive web applications inspired by Elm.
Bonsai is a UI library for building performant, reactive web applications in OCaml, partly inspired by Elm. It is used for almost all web applications inside Jane Street. Components are purely functional state machines, incrementally rendered only when relevant state changes. State is managed outside the component hierarchy, with extensive APIs for lifecycle and scoping. Bonsai supports a templating language, component-specific stylesheets, and whole-app automated tests with expect-style diffing. It also powers terminal-based UIs via Bonsai_term.
What commenters are saying
Commenters noted Bonsai offers terminal UI support via Bonsai_term, not just web. Several pointed out that shared front-end/back-end languages are not new: examples include Clojure/ClojureScript, Scala.js, F# via Fable, Elixir/Phoenix LiveView, and earlier OCaml projects like Ocsigen and Eliom. Some dismissed UI frameworks as less relevant with AI-generated code, while others argued stricter compilers still aid productivity. A user praised OCaml's type safety but questioned compilation speed, hot reload, and bus factor.
One commenter joked that Jane Street builds its own tools because it prefers OCaml for everything. Another expressed frustration with OCaml's limited marketability outside Jane Street.