The Gemini protocol – a model of simplicity
Posted on January 15, 2023, by Sébastien
If you're reading this blog on the Web, you've probably noticed the minimalistic design.
This is intentional.
The Web version was directly converted from the Gemini version, which you can read at the following URL:
You'll need specific software to open this link. Namely, a Gemini client ("browser", if you will). More on that below.
1. What is Gemini?
The Gemini project is first and foremost a protocol, with an associated file format.
It was started in 2019 by a developer who goes by the pseudonym of Solderpunk.
Here's the official website of the project:
1.1. The protocol
In short, Gemini is an application-layer protocol, running on top of TCP. In that regard, it's similar to HTTP.
As shown above, Gemini links start with the following URI scheme:
1.2. The file format
The Gemini specification defines the "text/gemini" file format, which is a simple text-based format.
It was inspired by the Markdown syntax, although it's intentionally simpler.
Here's an example of what a raw "text/gemini" document might look like:
# Level 1 title This is just a regular line of text. ## Level 2 title * This is a list item * Another list item * And another one ### Level 3 title => https://example.com/ Example link => gemini://sebastinux.com/ Only one link per line is allowed > This is a quotation ``` Preformatted block. Will use a monospaced font, and retain spaces. -> Like this indented line. Useful for source code, ASCII art, … ```
Even though it's quite short, the document above actually demonstrates all different formatting options available in the "text/gemini" file format.
Gemini files can use the ".gemini" or ".gmi" extensions.
The two key advantages of Gemini are:
- its simplicity,
- its focus on privacy.
The modern Web has become so complex that developing a browser engine from scratch is now virtually impossible.
There are basically only 3 main browser engines left:
- Gecko, from Mozilla, powering Firefox,
- WebKit, from Apple, used by Safari,
- Blink, from Google, as found in the Chrome browser, as well as Microsoft Edge, Opera, Brave, and countless others.
As of 2022, all three web browser engines consisted of around 25 million lines of code each.
OK, so, what about Gemini?
Gemini, on the other hand, specifies an extremely simple file format – as shown in the sample in section 1.2. – allowing any developer to parse it in a matter of hours (and I'm being generous).
The protocol is equally simple, which means that a basic Gemini client can be written with just a few hundred lines of code.
Actual Gemini clients typically use between a few thousand and ~100,000 lines of code.
The Web is a privacy nightmare, where everything can be used – and is used – to track you:
- Cross-domain images (sometimes hidden)
- Browser fingerprinting
- And much more…
Even HTTP ETags – a caching mechanism – and favicons have been abused to track users.
By contrast, Gemini was designed to protect user privacy from the start.
It achieves this by setting strict limitations on features, and by being purposely non-extensible.
The Gemini project is defined as much by its features as by its limitations, which are very much intentional.
In particular, the protocol doesn't support:
- Resuming interrupted downloads
- Request headers, such as "User-Agent" or "Referer" – or cookies!
The first 3 points make the protocol simpler, and the 4th item really helps prevent user tracking.
As for the Gemini file format:
- No external requests
- No styling – rendering is 100% controlled by client software
- No bold or italics
- No in-line links – only one link per line, and nothing else
- No in-line images – users typically have to click image links to display them
Again, these restrictions not only simplify parsing, but they also help protect user privacy.
I initially thought the lack of bold text was a pity, but I can tell you that I really appreciated being able to determine how to handle a line by just looking at the first 3 characters, when I wrote my own Gemini-to-HTML converter.
4. Recommended uses
Gemini does not aim to replace the Web, but to co-exist with it.
It's considered to be a part of the "Small Internet" movement (sometimes spelled "Smol Net"). See also the related concept of "Slow Web".
Websites consisting of mostly text information are good candidates for Gemini.
Blogs, in particular, are a popular use of Gemini.
For instance, long-time blogger Lionel Dricot, alias Ploum, converted his entire blog to a "gemlog" in late 2022:
You'll find posts in both French and English.
Informative websites are also well suited to Gemini.
Unsurprisingly, you can find a lot of information about Gemini itself:
5. Suggested clients (browsers)
For most people, I would recommend using Lagrange to browse the Geminispace:
It's a good-looking GUI client, available for Windows, macOS and Linux.
As of early 2023, there's also a beta version for Android and for iOS.
For the geekiest among you, Amfora seems to be the most popular terminal-based option:
There are many other clients, as you can see from the following list: