First look at..proto

Icarus

I dove in to fast and that was my fault. A nice thing about the ATProto is that most of the data is freely available. You can just start to experiment with it without any hurdles. So this was what I did and that was my mistake. The protocol is simple and the basics are easy to learn, but there are still some basics that need to be understood before starting. This is well documented. So I would recommend my younger self (from two weeks ago) to start reading understanding Atproto. It is nice to read and easy to understand, but nonetheless important info.

The lexicons

Working with lexicons is a new way of working for me. I had learned from my mistakes so now I started by reading the documentation. It is like npm but with extra steps. This broke my brain a bid at first. You think you know what will happen and for the most part you do. But that makes the different parts more frustrating to understand. This was one of the reasons I started writing this blogpost. Maybe this will help someone evade these frustrations.

You install the global npm package with:

npm install -g @atproto/lex

Then you can use the lex command like would with npm:

lex install app.bsky.feed.post app.bsky.feed.like

Tip: Something I did not now in the beginning and which made lexicons easier to understand for me was that you can look at these paths as reversed urls. app.bsky -> https://bsky.app , site.standard -> https://standard.site

This adds these "dependencies" to a lexicons.json file similar to the package.json. And it adds a lexicon directory to your project. This part is same same, but different to what you would expect from node_modules. It took me a while to figure that out.

Same same: The contents of this folder are based of the lexicons.json folder. So similarly to this folder you can put is in the .gitignore file. When you have a lexicons.json file you can run

lex install

and based on the content of lexicons.json this folder will be populated with the correct lexicon references.

But different: This lexicons folder is not used in you project to make use of the lexicons like you would use the node_modules. There is an extra step, run:

lex build

This creates a ./src/lexicons directory containing all the necessary type definitions. These can then be used in your project.

XRPC

I don't understand it enough to write it down. Just understand that there is a confused guinea pig on the other side of the keyboard.

It has something to do with RPC which I don't really understand... It feels like a fetch request but not really...

This one is for future me, bye.