pds/a teaching port

The book

How to build your own PDS

A chapter per subsystem, in reading order. The code that each chapter discusses lives in src/pds/; jump between the two as you go.

  1. Chapter 00

    How to read this book

    This is a long-form, hands-on guide to building a Personal Data Server for the

  2. Chapter 01

    What is a PDS?

    A Personal Data Server is the piece of the AT Protocol that holds your

  3. Chapter 02

    The AT Protocol at a glance

    Before we touch any code, we need shared vocabulary. The AT Protocol is built

  4. Chapter 03

    Architecture of this PDS

    This chapter is the map. It explains how the code under [src/](../src/) is

  5. Chapter 04

    DIDs, handles, and AT-URIs

    Identity is the foundation. Before anyone can store a single byte on this

  6. Chapter 05

    Content addressing and DAG-CBOR

    Before we can build the Merkle Search Tree in the next chapter, we need to

  7. Chapter 06

    Merkle Search Trees

    This is the chapter that pays for the rest of the book. The Merkle Search

  8. Chapter 07

    Commits and signing

    The MST from the [previous chapter](./06-merkle-search-tree.md) gives us a

  9. Chapter 08

    CAR files

    By chapter 07 every block in the repository is content-addressed: a chunk

  10. Chapter 09

    Lexicons

    Every record on this PDS, every XRPC procedure it serves, every event on

  11. Chapter 10

    XRPC: HTTP API conventions

    The AT Protocol's RPC layer is called XRPC. The name promises something

  12. Chapter 11

    The database schema

    The PDS's authoritative storage is Postgres. The MST itself isn't in

  13. Chapter 12

    Account creation and did:plc

    This is the longest single endpoint in the PDS. Registering an account

  14. Chapter 13

    Authentication

    Account creation handed back two JWTs. This chapter is about what those

  15. Chapter 14

    Reading and writing records

    Chapter 12 created the account and an empty repo. Chapter 13 made the

  16. Chapter 15

    Blobs

    A typical Bluesky post is a few hundred bytes of JSON. A single image

  17. Chapter 16

    Event sequencer and the firehose

    The firehose is the PDS's public stream. Every commit on every account on

  18. Chapter 17

    PDS vs AppView vs Relay

    You've built a PDS. By chapter 16 it owns repositories, signs commits,

  19. Chapter 18

    Running in production

    You've reached the end of the book with a working PDS. It signs commits,

  20. Chapter 19

    Moderation

    Chapter 18 ended the main book with a working production PDS and a list of

  21. Chapter 20

    Migration

    A user's DID lives on a third-party log (plc.directory) and points at a

  22. Chapter 21

    OAuth

    Chapter 13 handed clients a pair of HS256 JWTs whenever they typed the

  23. Chapter 22

    A minimal client UI

    So far in this book the PDS has been a server you talk to with curl. That's

  24. Chapter 23

    Backups

    The PDS is the only thing in the network that has a copy of every byte