Biff tutorial: build a chat app step-by-step

Last night I finished writing the last section of Biff's new official tutorial. This project was funded by a grant from Clojurists Together. A huge thank you to them and all their donors, as well as to JUXT and others for their ongoing sponsorship of Biff.

The new tutorial takes you through the process of building an app called eelchat.

eelchat is like a barebones version of Slack, Discord, and the like. From the introduction:

In eelchat, users can create communities, each of which has a collection of channels for text chat. Channels can only be created and deleted by the user who created the community (i.e. the admin). The admin can also add RSS subscriptions to channels, so new posts will be displayed.

In building eelchat, you'll get a tour of all of Biff's main parts, including:

  • Creating and deploying a new project (I like to get new apps in production right away)
  • Rendering pages with Rum and Tailwind
  • Modeling your app's domain with Malli schemas
  • Doing CRUD with XTDB and htmx
  • Pushing updates to the client with transaction listeners, htmx, and hyperscript
  • Handling background jobs with scheduled tasks and in-memory queues

All of the code is available on GitHub, with a separate commit for each section. Links to the commits are included throughout the tutorial. And at the end there are suggestions for additional features you can add to eelchat, so you can get a chance to spread your wings. 

A few people over in #biff on Clojurians Slack have already started working through the tutorial as I've been releasing the sections over the past weeks, and I haven't been alerted to any glaring faults yet. I did do some refactoring last night though, and I don't have it in me to go through the entire tutorial myself just yet, so let me know if you run into any snags.

I am planning to update the code formatting. Most of the code blocks were pasted verbatim from git diff, which is a quick way to write a tutorial though perhaps not the pinnacle of UX. You'll have to delete a bunch of +s at least. (Maybe I'll finish that tonight and render this paragraph obsolete... but if you're reading this, that didn't happen.)

Now that the tutorial is finished, my next order of business is to get Platypub to a state where I can run a publicly available instance of it. When that's finished, Biff will have not just a fabulous tutorial, but also a killer app that anyone can try out easily. Part of my grand scheme is still to have Platypub become a hook that brings more people into the Clojure ecosystem—e.g. custom themes in Platypub are just Babashka scripts.

Concurrently, I'll continue to write more documentation. I'd like to add a page with links to resources for learning Clojure, and I've got a handful of how-to articles I'd like to write (such as "how to do pagination with htmx," "how to receive email," and "how to scale out"). In general my plan is to spend my time roughly 50/50 between writing open-source apps with Biff and writing documentation. (I'd also like to start doing meetups again, but I'm going to keep those on hiatus at least until the end of the year.)

If there's anything you'd like to see in Biff world, let me know. And remember...

Published by Jacob O'Bryant on 23 Nov 2022

Sign up for Biff: The Newsletter
Announcements, blog posts, et cetera et cetera.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.