# Jane Street's Bonsai: A UI Library That Treats State Like LEGO

Original title: Bonsai: Janestreet's UI Library

> Hacker News story 49152842 · language: en · submitted 2026-08-03
> Web version: https://zeli.app/story/49152842
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 379 · by [KolmogorovComp](<https://news.ycombinator.com/user?id=KolmogorovComp>) · 💬 151
[original](<https://github.com/janestreet/bonsai>) · [HN discussion](<https://news.ycombinator.com/item?id=49152842>)

## Summary

Jane Street's Bonsai is a UI library for building reactive web apps in OCaml, used internally for everything from corporate directories to trading tools. Unlike frameworks that fuse state, incrementality, and rendering into one component, Bonsai lets you compose these primitives a la carte. This separation enables efficient incremental updates and flexible state management, even for complex scenarios like tabbed interfaces. Built on OCaml, it allows sharing types and logic between backend and frontend, and comes with a powerful templating language and expressive testing tools.

## Key quote

> The same primitives that prevent re-rendering the entire page during user interaction can also be used to incrementalize an expensive business logic computation on a live-updating dataset.

## HN discussion (151 comments)

### [flufluflufluffy](<https://news.ycombinator.com/item?id=49153587>)

> \> And because Bonsai is written in OCaml, it becomes possible to use the same language and types on both the backend and frontend.
>
> Finally! I was waiting for this to become possible!

### [bsmith89](<https://news.ycombinator.com/item?id=49157870>)

> There's a great Signals and Threads (Jane Street's Podcast) episode about this work: https://signalsandthreads.com/building-a-ui-framework/

### [chrischen](<https://news.ycombinator.com/item?id=49154414>)

> Curious how this compares to Melange which is used by Ocaml shops as well to double up on Ocaml for both front and backend (ahrefs being the major user and sponsor). Does this mean giving up a lot of the JS ecosystem (React, graphql, etc)?

### [rw2](<https://news.ycombinator.com/item?id=49154525>)

> I am sure it's very performant, but to me it's extremely ugly; Surely someone can fix margins and still have it be performant.

### [cachius](<https://news.ycombinator.com/item?id=49156281>)

> What does JaneStreet do besides sponsoring nerdy Youtube channels and writing UI libraries?

### [user2342](<https://news.ycombinator.com/item?id=49155443>)

> Interesting! What are Bonsai's dependencies? I use OCaml but - so far - none of Janestreets libraries etc.

### [Schlagbohrer](<https://news.ycombinator.com/item?id=49154743>)

> Can someone who understands web UI programming tell me if this would be good for my local agent to use to produce HTML based reports and outputs for me? Or for TUI outputs?

### [xvilka](<https://news.ycombinator.com/item?id=49153108>)

> Looks like it's Web-only, no mention of the native UI support (terminal UI excluded).

---

## Cite

- Page: https://zeli.app/story/49152842
- Date: 2026-08-03
- Source: github.com (https://github.com/janestreet/bonsai)
- Hacker News: https://news.ycombinator.com/item?id=49152842

## Other languages

- zh: https://zeli.app/zh/story/49152842 · markdown: https://zeli.app/zh/story/49152842.md
- ja: https://zeli.app/ja/story/49152842 · markdown: https://zeli.app/ja/story/49152842.md
- ko: https://zeli.app/ko/story/49152842 · markdown: https://zeli.app/ko/story/49152842.md
- de: https://zeli.app/de/story/49152842 · markdown: https://zeli.app/de/story/49152842.md
- es: https://zeli.app/es/story/49152842 · markdown: https://zeli.app/es/story/49152842.md
