Platypub: plans for building a blogging platform with Biff

As a way to help people learn Biff, I've been thinking about creating a "large" (compared to toy projects, at least) example application. Ideally it would be something genuinely useful that would warrant ongoing development for a long time, perhaps indefinitely. A project like this could serve several purposes:
  • Give people a code base to read and learn from.
  • Give people opportunities to make PRs for an application they use themselves.
  • Give me another project to dogfood Biff on (in addition to my startup).
  • Give me direction on what to write and create videos about. e.g. after implementing a feature that's likely to be needed in other projects, it would take little effort to then write a "How to do X with Biff" tutorial. It also might be fun to record pair programming sessions, where someone else implements a feature and I provide guidance as needed.
  • Help people get interested in Biff and/or Clojure in the first place (because they use the application)

An ulterior motive is that I always have several ideas for web apps I wish existed, and it'd be swell if the time I spend on Biff could also help those ideas get implemented.

My preferred project idea for this is a blogging and newsletter platform, which—after finding that the .com was available—I'm naming "Platypub." I have about five different places I publish content to semi-regularly, and for months I've been pining for a single piece of software that would handle all of my needs in one place. Plus lots of programmers have blogs, so perhaps many Biff users would have fun hacking on this.

(This also would be complementary with my startup, a newsletter aggregator. The most common platform that people use by far is Substack, but I have several beefs with them and wouldn't mind having a good alternative to recommend to people. At some point I might deploy a Platypub instance myself for that purpose, but if someone else wanted to try doing it as their own bootstrapped business, that would be even better.)

At a high level, I'd like to:

  • Write all my posts in one place, regardless of where they end up getting published.
  • Define site themes with Clojure and share them with other Platypub users.
  • Use managed services for hosting the site and for newsletter link handling (e.g. unsubscribe requests). If Platypub goes down, I don't want that to impact anyone reading my site/newsletter.
  • Have the option to use Platypub locally for myself (by serving the app on localhost). This is made possible by the previous point.
  • Deploy a Platypub instance and have it be usable by non-programmers, with an economically viable free plan (i.e. a single instance should serve multiple users).

Implementation details

It looks like TinyMCE would be a good choice for a drop-in rich text editor. There should also be an API for adding posts. Maybe support "import plugins" which would sync content from external sources regularly (for example, there could be a plugin for importing tweets from your Twitter account).

There should be a UI for creating new sites. Each site has its own configuration settings, including filters to specify which posts belong to which site. I guess we also need "pages" (like "home", "about", ...). There might also be theme-specific configuration.

A theme should be, in essence, a Clojure function that takes as input a site configuration and a set of posts and outputs a map from file paths to file contents (for example, {"/index.html" "<html>...</html>"}). This does present a difficulty: if you want to permit 3rd party themes (and we do), the theme code must run in some kind of sandbox. This might be a pain (hopefully it's feasible at least), but it doesn't have to be done right at the start. After that's figured out we can decide on how to package and distribute themes. Themes also will need to handle email templates for newsletters.

Sites can be deployed to Netlify. We can use Mailgun's Mailing List API for newsletters. Mailgun will handle open and click tracking (if you choose to enable it) and unsubscribes. However we'll have to provide the signup form. The Netlify site can include a backend function (probably written with plain Javascript) that will take a form submission, validate a Recaptcha token, check the address with Mailgun's validation API, and then (on success) add the address to the mailing list and trigger a welcome email. If the Recaptcha token returns a high probability of the user being a bot, a confirmation email should be triggered. (You should also be able to require a confirmation email for every signup if you so choose.)

Finally, the Platypub API should also let you retrieve both raw posts and the rendered files for a site. That way you have the option of deploying from a separate application (i.e. have the app put a site in one of its own subdirectories) while still letting Platypub do all the rendering.

When ready, I'll start using Platypub to publish this website, followed gradually by my other sites.

Published by Jacob O'Bryant on 19 Apr 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.