This repository contains a "sample" of an ATproto lexicon that defines everything needed to build a guestbook program.
The structure is as follows:
lexicons/
contains the lexicons definitions.lexicons/com/fujocoded
contains our own definitionslexicons/com/atproto
contains the ATproto base definitions which are necessary for the program to work
client/
contains a client application that allows you to create guestbooks on your account and post submissions to any guestbook
Right now, this is mostly a sample and teaching repo. You can watch us build this live (or recorded) by following Ms Boba on Twitch.
⊹₊ ˚‧︵‿₊୨ ᰔ ୧₊‿︵‧ ˚ ₊⊹
Support FujoCoded on Patreon for More of This™!
⊹₊ ˚‧︵‿₊୨ ᰔ ୧₊‿︵‧ ˚ ₊⊹
The first step to use the client is to generate the lexicon API using the
definitions in the lexicons/
folder. You can do this using the
@atproto/lex-cli package.
npx @atproto/lex-cli gen-api ./client/generated/api ./lexicons/**/*.json
Note: this is deprecated but Ms Boba doesn't care because she doesn't want to implement OAuth right now.
Follow the instructions here.
You will need to add this in a .env
file within client/
.
APP_PASSWORD=your_password
Remember: you need to
npm install
the dependencies first!
- Open
client/create-guestbook.ts
and change things around to your desired data. - ENTER THE CLIENT DIRECTORY (
cd client
) - Run
npm run guestbook:create
- Open
client/create-submission.ts
and change things around to your desired data. - ENTER THE CLIENT DIRECTORY (
cd client
) - Run
npm run guestbook:submit
You can see all the submissions as they happen with the following code:
websocat wss://jetstream2.us-east.bsky.network/subscribe\?wantedCollections=com.fujocoded.guestbook.submission | jq 'select(.kind == "commit")'
npx @atproto/lex-cli gen-server ./client/generated/server ./lexicons/**/*.json
TODO: move these to the appview folder
TODO: write how to get the appview working
- Enter the AppView directory with
cd appview/
- Generate the private key:
openssl ecparam -name secp256k1 -genkey -noout -out private_key.pem
- Generate the public key:
openssl ec -in private_key.pem -pubout -out public_key.pem
Right now, you can't (unless you want to implement the whole thing from scratch)! Come to the streams and stay tuned for more functionality around this.
Experimented too much and hate leaving a mess around? Delete everything with
npm run guestbook:dangerously-delete-everything
, which will (again) DELETE EVERYTHING.
If you want to be more targeted, you can modify client/delete-everything.ts
.
Good luck!
- Get someone else to write in the lexicon!
- Display other lexicons
- Allow guestbooks moderation (e.g. delete entry)
- Allow blocking users
- Allow restricting which URLs a guestbook is displayable on
- Return handles of users
- Accept guestbook submissions from HTML
- Improve HTML generation
- Check out CORS
- Allow creating guestbooks
- Get rid of app passwords
- Allow submission via form
- Create Astro plugin
- Create guestbook webcomponent(?)
- Catch up with cursor