chatto.ts: Strictly typed Chatto Framework

Writing a strictly-typed SDK, for the Chatto project.

coding ThinkPad X1 Carbon Gen 10

Last week, I was doing my usual browsing of ycombinator, when I came across a post that read Chatto is now open source, which caught my attention, especially because the post (at the time of writing) had over 1100 points, so I had to look at what all the fuss was about.

I checked out the post, and it was immediately filled with incredible- if true claims, such as “extremely easy to self-host”, “very light on resources”, “snappiest frontend that you’ve ever used in an app like this”, “fully encrypted at rest”, and “voice and video calls”. Now this wouldn’t be the first time something like this pops up and it ends up being a lot less than what you would’ve wanted, or a garbled mess of AI slop that does not work in the slightest.

So I decide, only one way to find out, I open the documentation and to my surprise- it is very well documented, it is detailed, it has all the instructions you would want. I got it set up within 30 minutes of reading, with email configured, oauth2, s3 storage and everything else you may want for your own private self-hosted instance.

The UI is fast, snappy and responsive, so obviously I had to make my test instance more “permanent”, so I made it look nice and pretty, got some friends to join it, configured it on some devices and there I was, within 1 hour of time I had a fully working production instance, and most importantly all mine. This with Discord’s recent shenanigans convinced me to make this a more permanent platform and community I would want to be a part of.

They host an instance you can register and join at chat.chatto.run. I immediately started snooping about, and noticed that there were no easy ways (yet) to programmatically create a “bot” user, personally I am most familiar with TypeScript, so I decided to create chatto.ts.

This was also an excuse to try some new things I have been itching to implement or try for a while. Specifically I’ve been wanting to try the bun:test utilities, and try and see how proficient agentic coding with a rigorous testing harness really is.

And honestly I am quite surprised, I find that you need to baby-sit it a decent amount, and you (as the operator) have to lay the groundwork for what it should be and make the large design decisions, as (in my experience) every model you use seems to be quite bad at writing code consistently. I often found myself asking the models to produce certain functionality and then it would do that well, but very inconsistently. Code consistency in my opinion is quite important to manage the future of an application, if you implement something differently everywhere you aren’t going to have a great time porting all of that when inevitably it changes.

But overall, the experience was fun, it was surprisingly easy, though easily gets expensive if you want it to do something well with strict guidelines.

But the bun:test suite itself works well, it has the features I would want and does help to steer the LLM’s to produce the code you want, and still have it work.

Links