7 ms·
Bonsai: Janestreet's UI Library
- user2342 2mo agoInteresting! What are Bonsai's dependencies? I use OCaml but - so far - none of Janestreets libraries etc.
- LeonidasXIV 2mo agoBasically most of Jane Street's published code[0] via its dependency on Core. [0]: https://github.com/janestreet/bonsai/blob/f31661450eb133fe89564219d97669c2735c6622/bonsai.opam#L13-L32 https://github.com/janestreet/bonsai/blob/f31661450eb133fe89...
- xvilka 2mo agoLooks like it's Web-only, no mention of the native UI support (terminal UI excluded).
- avsm 2mo agoThere's a full terminal implementation of Bonsai as well. I actually use it in my personal workflow these days to manage my contacts database! https://anil.recoil.org/notes/aoah-2025-9 https://anil.recoil.org/notes/aoah-2025-9
- aquariusDue 2mo agoUnrelated but what do you use to manage your personal website? I love how everything is interconnected.
- avsm 2mo agoCustom infrastructure; I use my site as a playground for various things over the years. It ran as the first MirageOS unikernel for many years, and recently it's been running on a zero-allocation OxCaml webserver https://anil.recoil.org/notes/oxcaml-httpz https://anil.recoil.org/notes/oxcaml-httpz to help me get to grips with the new extensions.
- keepupnow 2mo agoYou are crazy intelligent. You are cool.
- abtinf 2mo agoSeconding the sibling comment - what are you using to run your personal site? It is very nice.
- hahahaa 2mo agoOh it needs a userland trampoline! > JSOO does not have tail call optimization
- debugnik 2mo agoJsoo supports self-recursive and mutually recursive tail calls, but for general tail calls it would need to trampoline every single call, since the only major browser with proper tail calls is Safari.
- Traster 2mo agoThe "Why Bonsai?" I found really funny. Let me re-write that section for you: Why Bonsai? At Jane Street we're super excited by Functional programming and by CAML in particular, so when we need low latency software, we use OCAML, when we need hardware, we write out own langauge - HardCAML, and when we need a Web UI, we build a Web UI framework in CAML. Because we fucking love CAML.
- bofeiw 2mo agoAgreed, looks like it's reinventing the wheels. Frameworks does not really matter today, AI agents write the code anyway.
- ForHackernews 2mo agoBetter frameworks will still help AIs avoid silly mistakes. A smarter framework means you can be productive with a dumber/cheaper AI.
- KolmogorovComp 2mo agoBut AI do benefit a lot from a strict compiler, and having a simple language improve a lot on type-safety, so I don't think it is to throw, even today.
- rmzs0711 2mo agoBut what about compilation speed? Hot reload? Maintainability? What is the bus factor for these kind of technologies? Yea, its cool to have strict type safety, but what's the point of it doesn't have all the benefits from other Frameworks that took years to polish
- OtherShrezzing 2mo agoJaneStreet has enough free cash to not worry about those issues. If one of their key persons dies in service, they can go out and contract the worlds leading expert in that domain, and their annualised rate isn’t even a rounding error on their bottom line.
- kubb 2mo agoI wish there were more OCaml shops out there
- bobjansen 2mo agoThis would of been cool back in 2014.
- _flux 2mo agoOcsigen and Eliom were started 2005 and are pretty similar, although I can't find any well-known projects using Eliom :/. Presumably this has learned some lessons from it, so it's probably better.
- ramesh31 2mo ago>"This would of been cool back in 2014." Pretty much. UI libraries are more or less meaningless now, and I say this as someone who spent the last decade building them. Given a proper data API to work against, you're a single prompt away from a fully tested bespoke lib that's more maintainable and has no dependencies. The weeks of work you saved by reaching for one before is gone, and the tradeoff you had to make of dealing with upstream changes and lack of customization just isn't there anymore.
- keepupnow 2mo agoActually let me correct you. Its cool now because early 2000's is back on trend baby
- bobjansen 2mo agoYes. I would make frontends with handlebars back in 2008-2012. It was a big improvement from PHP.
- flufluflufluffy 2mo ago> 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!
- philipwhiuk 2mo agoSimilar attempts include Scalajs. The general challenge becomes integrating the fractional front-end code written in your backend-language that compiles to JS with the rest of the JS ecosystem. JaneStreet have a love of writing their own stuff from scratch so it doesn't apply to them but it might to you. Hence most people end up with frontend-as-backend rather than backend-as-frontend.
- lbourdages 2mo agoCouldn't WASM solve that problem once and for all? Is there some limitation that WASM has that JS doesn't? Disclaimer: I am very inexperienced at front-end development.
- danielheath 2mo ago> Is there some limitation that WASM has that JS doesn't? You need a JS trampoline to call your WASM and make browser primitives available to it, and IIRC calls into browser code incur some extra overhead, but those are pretty manageable. Additionally: for high level languages, source code is _much_ smaller than compiled binaries. If your initial needs are simple, your users are likely downloading more than 10x as much code.
- applfanboysbgon 2mo agoWASM does not (yet) have access to the DOM or web APIs, meaning every direct interaction with the browser must first go through JS interop anyways, with a resulting performance penalty. There are proposals, and maybe we'll see it happen by 2035, but as of now WASM is best suited for heavier workloads where the edge in application performance outweighs the cost of JS interop with the browser rather than being a universal solution.
- gigatexal 2mo agoAll your money and retirement funds are safe; I’m too dumb to work at JaneStreet; every time I see OCAML I feel less than and confused.
- gigatexal 2mo agoAww thanks folks. All the downvotes to this means folks don’t think I’m dumb and also don’t like the self deprecating humor.
- gosub100 2mo agoIt's also a way to retain employees. If you are an expert ocaml writer, you aren't a drop in replacement at the competition. So while I'd love to work there, a lot of the knowledge isn't very marketable after you move on.
- ubercore 2mo agoNot sure why, but reminds me of Fog Creek's Wasabi.
- chrischen 2mo agoCurious 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)?
- sroerick 2mo agoMy understanding is that js_of_ocaml has been around longer and likely has a stronger ecosystem, but Melange was designed more specifically to play nice with the JS ecosystem.
- mjmahone17 2mo agoA good GraphQL server and client should be relatively straightforward to make in OCaml. Especially if you start from the premise that fragment spreads compose, rather than inherit. Relay’s (second) compiler was prototyped in OCaml, but we ended up switching to Rust for the main rewrite in the belief that we’d be able to use the same runtime code across iOS, Android and JS environments. Please somebody make a good OCaml GraphQL compiler, server, and client.
- chrischen 2mo agoI've been using Resgraph, but it's based off Rescript, a fork of ocaml.
- nbevans 2mo agoIt looks like a nice little library; but oh boy must this be so limiting for the product teams that are forced to use. Everything looks like it's straight out of the 1990s.
- rixed 2mo agoWhat do you mean? What's the connection with the product teams? Why would product teams care what low level web framework is used?
- HFguy 2mo agoWhich is fine if you are building tools for financial professionals. It is the aesthetic of choice. And is generally very functional for this purpose.
- adastra22 2mo agoThe “The thinking in bonsai” link 404s. This says it is based on Elm. So it has the same clean immutable state structure?
- rw2 2mo agoI am sure it's very performant, but to me it's extremely ugly; Surely someone can fix margins and still have it be performant.
- pgwhalen 2mo agoI’m no UI expert - what’s wrong with the margins?
- LooseEquipment 2mo agoinconsistent and maybe too tight, but I would think those are issues with the sample UIs and not this library
- ctxc 2mo agoProbably because they skew towards higher information density
- pgwhalen 2mo agoFrom experience I can say that traders prefer extraordinarily little whitespace in their UIs.
- OneDeuxTriSeiGo 2mo agoFWIW if you listen to Signals and Threads (the Jane Street podcast) they talk about this. They have dedicated UX designers who do relatively little code but focus entirely on making the UX as optimal for the traders as possible and one of them was on an episode. They talked about how most of the normal UX rules for SW go out the window because quants and traders have such different needs than "normal software".
- jackcarter 2mo agoIs there any professional software that wouldn't benefit from high information density? Most software design is optimized for the non-users who have to approve it.
- Schlagbohrer 2mo agoCan 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?
- antonvs 2mo agoProbably not, because your agent won’t have much info about this tool in its training set.
- disconcision 2mo agoi maintain a codebase that uses Bonzai (https://github.com/hazelgrove/hazel/ https://github.com/hazelgrove/hazel/); agent based development works just fine, though probably a bit more token churn
- derdi 2mo agoThere was this submission two months ago: https://news.ycombinator.com/item?id=48365904 https://news.ycombinator.com/item?id=48365904 . Basically they have a TUI frontend for the same thing. And the blog post says: "Bonsai_term would feel familiar to anyone who’d ever done web development here, and it had the huge advantage of being especially amenable to AI assistance. It was actually somewhat of a mystery to us how good the models were at writing Bonsai_term code, given how relatively obscure it is [...]"
- tikhonj 2mo agoThe main thing that Bonsai gets you is a nice programming model for making your UIs interactive. If you're mostly producing static reports (with maybe some basic interactive visualization widgets or something), it will not get you much over generating some variant on HTML + JS. It makes more sense for applications where you have complex interactive logic in the UI, with a lot of different components that need to control and display some shared state.
- tecoholic 2mo agoWhy does this library get posted here, what feels like every month? I remember it seeing at least twice before.
- MrBuddyCasino 2mo agoThis is great. It focuses on utility and information density over design. It looks like someone took a terminal UI and transplanted it to the web, Bloomberg terminal style. I'm pretty sure you can build tools with this that are fast and pleasant to use.
- simonask 2mo agoI really want to like OCaml. One day I'll get around to learning it.
- yuanBuilds 2mo agoIt might be a very performant UI framework in OCaml, but all the UI elements look extremely unpolished to me, like what a really smart high-school kid would build the GUI for his side project on Windows in 90s. Thanks, I can use JS as a functional programming language.
- pianoben 2mo agoWindows and especially Macintosh UIs from the late 90s/early 00s were by far the most functional UIs we've ever had since the dawn of the desktop era - user research was a serious discipline, accessibility was baked in to the frameworks, and the HID guidelines that devs adhered to gave us uniform conventions that we users could rely on. If the biggest criticism of Bonsai is "it ain't pretty but it works", then long life to Bonsai - give me more, please!
- keepupnow 2mo agoI agree, we have lost the beauty of early user interfaces. You summarised it well, thank you.
- rixed 2mo agoDid you maybe confuse bonsai with a CSS library? How to build web UI != How to style HTML. Bonsai solves a different problem.
- deleted 2mo ago[deleted]
- cachius 2mo agoWhat does JaneStreet do besides sponsoring nerdy Youtube channels and writing UI libraries?
- phplovesong 2mo ago[flagged]
- hatred 2mo agoThe above might be too far-fetched as it only applied to India? They did pay a fine to the regulator and resumed trading (might not be the same strategy though) To OP’s original question, they made $20B last year and have a niche in several financial products
- phplovesong 2mo agoYes, the fraud was done in india. Why does that matter?
- fn-mote 2mo ago“Banned from the Asian markets” was the original claim. The actual fact is: banned from Indian markets, with the ban now lifted.
- phplovesong 2mo agoSure, so "its all ok now" seems to be the goto here. Who knows other shady stuff they had done / are doing. A big wart on them, and the entire ocaml ecosystem.
- monooso 2mo agoThis doesn't seem quite as clear-cut as you're making out. The Securities and Exchange Board of India (SEBI) have accused Jane Street (JS) of market manipulation, JS claims it was legitimate arbitrage, and the case is still ongoing [1]. As I understand it, the ban only applied to Indian securities (not Asian markets as a whole), and was lifted back in July 2025 after JS paid ~$560 million (the alleged ill-gotten gains) into an escrow fund. They don't appear to have resumed trading, though [2]. [1]: https://www.reuters.com/legal/government/us-trading-firm-jane-street-files-appeal-against-india-markets-regulator-2025-09-03 https://www.reuters.com/legal/government/us-trading-firm-jan... [2]: https://www.reuters.com/sustainability/boards-policy-regulation/jane-street-gets-approval-resume-trading-india-after-567-million-deposit-2025-07-21 https://www.reuters.com/sustainability/boards-policy-regulat...
- phplovesong 2mo ago[flagged]
- Paradigma11 2mo agoIf you read up on it that was basically India protecting its corrupt cronies. Janestreet showed severe problems with some Indian companies and instead of fixing that and creating a healthier and more transparent market they decided to go after the messenger.
- dtornabene 2mo agoWhy did you feel the need to post this same comment multiple times? Seems a bit suspect itself!
- shikck200 2mo agoLooks like OPs post was flagged. I have also seen this on multiple ocations. To me this is REALLY fishy. Since the janestreet fraud there has been a massive campaign online to downplay all negative comments, disable comments on JS videos, and overall radio silence. I know some long term ocaml users and i can tell you that there is stuff boiling under the hood. Many are very much NOT HAPPY with JS and what they did.
- bsmith89 2mo agoThere's a great Signals and Threads (Jane Street's Podcast) episode about this work: https://signalsandthreads.com/building-a-ui-framework/ https://signalsandthreads.com/building-a-ui-framework/
- strongly-typed 2mo agoA framing from that podcast that helped me better understand the role of Bonsai is that it's really a framework for building incremental distributed state machines.
- frutiger 2mo agoThis framing is also in the post. From the readme: > Bonsai itself -- this library -- is actually more generic than the above makes it sound. It allows you to build general-purpose incremental, composable state machines. Bonsai_web builds on top of that core library, specializing it for interactive browser-based UIs, but we also have Bonsai_term for building interactive terminal-based UIs.
- dtornabene 2mo agoThe docs are a bit sparing but if you read the source its pretty cool to see how they did this.
- HolyLampshade 2mo agoThe entirety of modern financial markets is simply incremental distributed state machines.
- lenkite 2mo agoThe value proposition about this web framework over things like React, Phoenix, etc is that it uses incremental computing right ? Using Jane Street's incremental computing library. I see it being used at https://github.com/janestreet/bonsai/blob/f31661450eb133fe89564219d97669c2735c6622/bonsai.opam#L21 https://github.com/janestreet/bonsai/blob/f31661450eb133fe89...
- 2mo ago
- Onavo 2mo agoConsidering how ridiculously verbose their library is compared to React/Vue it's a good thing we have LLMs to deal with the boilerplate now.
- rixed 2mo agoThe docs directory happen to be missing, therefore the links to the quick guide and to "thinking in bonsai" pages from the readme are broken. Also, I'm wondering how does bonsai-web update the DOM, is it via direct modification of the changed elements, or via some DOM differ? I'd say from direct update from a quick look at the source, but I'm unsure.
- pcan77 2mo agoHow on earth is this a web UI Library and yet there is no link to any sort of example page (like a github.io page or something) showing this off?
- rew0rk 2mo agoA more practical question: has anyone used this in production in internal apps at work? UIs like this look nice and have a flare that I like, but I guess it feels weird if I want to introduce this with my team over something like tailwindcss and rolling our own components
- VanTheBrand 2mo agoYeah, Jane Street
- keepupnow 2mo agoYes Jane Street
- jitl 2mo agoi think “i added ocaml” is much bigger innovation token spend then the styling question
- reindeer2 2mo ago[flagged]
- link89 2mo ago[dead]
- philspector 2mo agoCont:https://news.ycombinator.com/item?id=46156832 https://news.ycombinator.com/item?id=46156832
- sinuhe69 2mo agoI wonder why nobody hasn't created a SKILL file for Bonsai yet. I thought every library today would be introduced with a SKILL file in bundle.
- rezaprima 2mo agopleasantly surprised knowing that js of ocaml (that Bonsai used) is still active https://github.com/ocsigen/js_of_ocaml https://github.com/ocsigen/js_of_ocaml