Okay, I've probably said this at least a hundred times, but: did you know this blog is powered by Earthstar?
- I write regular markdown files in a regular directory on my regular filesystem using my regular text editor.
- I transfer those files' contents into a local Earthstar replica.
- I sync that replica to this web server, which happens to be an Earthstar peer itself.
- And because my webserver understands Earthstar, it uses it like a database to serve up these blog posts.
If you can't tell, I really love this. It means I get to use my favourite tools to author this blog. It means all my stuff is where I want it: offline, on my computer. And you know what? If I got serious about this blogging thing, I could get an editor, sync my stuff over to them, and get them to sync their edits to the webserver. Hypothetically.
The pattern of "edit files on your computer and sync them to each other + web servers" can be used for so much more than just blogs:
- What if you could easily collaborate on a Logseq or Obsidian knowledgebase with your friends and publish it online?
- What if you could author and publish a little website with your friends, Geocities style?
- What about a tiny, self-hosted CDN for you and your friends' funny images?
These are all things you could build with Earthstar, but until today only a huge nerd like me could be bothered to hook all of it up. So I've made a bunch of new tools to help more modestly-sized nerds do the same thing:
- A new Earthstar CLI with a filesystem sync feature
- A new extensible replica server framework which can also serve content over the web
- New templates for replica servers so you can deploy your own in just a few steps!
These things are useful separately, but together they are a lot more fun.
This is a complete client for everything Earthstar in your console:
- Generate and manage identity keypairs;
- Create, sync, and modify shares;
- Keep a list of replica servers you know and trust...
... and an exciting new feature: filesystem sync. This bidirectionally synchronises the contents of an Earthstar replica with the contents of a filesystem directory, so you can use your filesystem and favourite apps to view and modify a share's contents. For example writing and editing a bunch of markdown files with some fancy knowledgebase tool.
Here's a new guide to installing and getting started with the Earthstar CLI..
But what good is having a share full of cool documents if you can't sync them anywhere?
In the last few months I think I've written about five different replica servers: one that could sync with classic Earthstar clients; one that could serve content via the web; one that could sync over HTTP instead of websockets, etc. etc. Again, only a huge nerd like me is going to be bothered to do that.
Replica servers should be easy to run, easy to deploy, and users should be able to customise according to their wishes. So I've built a new extensible replica server framework which runs on both Deno and Node.
It has extensions for:
- Populating a replica server with replicas for known shares
- Syncing over websocket
- Syncing over HTTP
- Syncing with classic Earthstar clients
- Serving content from a share over the web
That last extension, the one in bold, is the coolest one. Whenever someone sends
a HTTP request to your replica server for, let's say,
/sandwiches/the-best-one.md, it will check if there's a document with a
corresponding path in an Earthstar replica and serve it up. If those documents
have hyperlinks, or references to images in them, they will also work just fine.
You can use this to build websites, wikis, knowledgebases, whatever. For now I'm
calling this fusing of webserver and share a webshare.
I want to make it trivially easy for people to have their own replica servers like this, so I've made a few templates which you can deploy in a single click. Here's one for Glitch.
To learn more about replica servers, there's a new guide on the Earthstar website.
If you'd like a complete tutorial on starting your own webshare, from installing and using the CLI to deploying a server, you can find one here.
And if you'd like to dig into the new replica server API, there's documentation aplenty.
Thanks, and what's next
Firstly, a huge thank you to the testers who helped test the new CLI and whose help really made it shine. It's so much more fun to build software when you have great people helping you.
Secondly, with this milestone finished, what's being worked on next?
Earthstar has some tight restrictions around how much data you can store per document: four megabytes. It also doesn't have an efficient way to store binary data like images or music. Obviously applications need this stuff — we want Earthstar to be usable for music collections, private instagrams, and media archives. So removing these limitations is where I'm turning my attention to next. That file sync feature is going to become something else.
As always, thanks to NLnet foundation for funding this work.