The AT Protocol's interesting design

Edit: This is a more technical explanation of the AT Protocol. If you want a less technical explanation, @danabra.mov has an article for that.

A Social Filesystem — overreacted

Formats over apps.

Bluesky. The social network with the butterfly logo. You've probably heard of it, even if you're not using it. However it's backend was built for more than a social network. It can support almost any app you can think of that needs to store data in a publicly addressable manner.

Bluesky's backend is based on the AT (Authenticated Transfer) Protocol, often abbreviated to ATProto. You can see the technical specs of ATProto at https://atproto.com .

Let's break down how the AT Protocol was designed, and why it handles more than Twitter-like social apps. In fact this blog post is stored on the AT Protocol.

The PDS: A form of decentralization

Each account is stored by a Personal Data Server (PDS). If you're just a normal Bluesky user who signed up at bsky.app, then your PDS is likely one of the many hosted by Bluesky PBC themselves.

The other major PDS provider is Blacksky, a community of Black users who develop on ATProto. One of their more well-known services is @moderation.blacksky.app , a moderation labeler similar to Bluesky PBC's own @moderation.bsky.app .

If you want to follow Blacksky's developments, their founder is @rude1.blacksky.team , and their main news account is @blackskyweb.xyz .

Because of this structure, you have to trust who owns your PDS. This is much like the Fediverse (ActivityPub), although implementations of ActivityPub vary WIDELY whereas ATProto is very standardized.

This trust factor is in contrast to protocols like Nostr or Polycentric , where your identity is defined strictly by cryptographic keys and your data can be stored across multiple servers instead of only one.

Repositories: your public database

On your PDS, your account has a repository, which is your database of publicly addressable data. You can actually "inspect" your own repository (or others' repositories) on websites like PDSls or ATProto Browser .

PDSls also features the ability to edit your repository by signing into your account, including adding/removing records and editing existing ones.

For the following sections you might want to go look at your repository or someone else's on PDSls, so you can see what I'm talking about.

Lexicons: defining data structure

In your repository you'll find lexicons, which define the types of data stored within. For most normal Bluesky users, you'll mostly see lexicons starting with app.bsky and possibly chat.bsky. The "chat" one relates to Bluesky's rudimentary direct message implementation, where as the "app" one relates to the main Bluesky network (the Twitter-like thing).

If you look at more advanced ATProto users like me, @rude1.blacksky.team (Blacksky founder), or @pfrazee.com (CTO, Bluesky PBC), you'll see many more lexicons.

These all have a reverse-domain notation, so if you reverse the first two words, you'll likely end up at the website that made those records.

Records: actual data

Inside each lexicon you'll find records. If a lexicon was made to only store one record, you'll find a record labeled "self". In most lexicons, you'll find a bunch of random strings. You'll see a short string called the record key (abbreviated rkey), and maybe a very long string starting with "baf..." called a Content ID (CID).

CIDs: a brief side tangent

Now, if you've been well involved in the decentralized technology community, and you start seeing random strings starting with "baf..." you might be wondering "is that IPFS?". ATProto has no connection to the Interplanetary Filesystem ( IPFS ), but they do share their forms of data structure.

The standard that ATProto and IPFS follow for structuring data is called Interplanetary Linked Data (IPLD). You can learn more about it at https://ipld.io .

Oddly enough, if you upload the same exact image with no modification (such as compression) in multiple posts, you'll add new post records but no new "blobs" will be stored by the PDS since it realizes that the files are bit-for-bit identical. This is because of how IPLD works.

Besides record keys and CIDs, each record contains key-value pairs, often represented by JSON.

For example, each Bluesky post is represented within the "app.bsky.feed.post" lexicon, and the records in this lexicon always contain a text: key containing the text content of your social post. You might also see other keys such as embed: (quote posts, posts with media, posts with a link preview...), reply: (links comments back to their parent post), or facets: (posts with links or pings).

In conclusion

I hope you were able to understand all that nerd speak... the raw structure of ATProto is quite complicated but it means that so many developers can make more apps on top of it.

I have more blog posts; find them on my WordPress instance or Nostr .

This has been Bit, I'll see you next time :>