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.
- Chapter 00
How to read this book
This is a long-form, hands-on guide to building a Personal Data Server for the
- Chapter 01
What is a PDS?
A Personal Data Server is the piece of the AT Protocol that holds your
- Chapter 02
The AT Protocol at a glance
Before we touch any code, we need shared vocabulary. The AT Protocol is built
- Chapter 03
Architecture of this PDS
This chapter is the map. It explains how the code under [src/](../src/) is
- Chapter 04
DIDs, handles, and AT-URIs
Identity is the foundation. Before anyone can store a single byte on this
- Chapter 05
Content addressing and DAG-CBOR
Before we can build the Merkle Search Tree in the next chapter, we need to
- Chapter 06
Merkle Search Trees
This is the chapter that pays for the rest of the book. The Merkle Search
- Chapter 07
Commits and signing
The MST from the [previous chapter](./06-merkle-search-tree.md) gives us a
- Chapter 08
CAR files
By chapter 07 every block in the repository is content-addressed: a chunk
- Chapter 09
Lexicons
Every record on this PDS, every XRPC procedure it serves, every event on
- Chapter 10
XRPC: HTTP API conventions
The AT Protocol's RPC layer is called XRPC. The name promises something
- Chapter 11
The database schema
The PDS's authoritative storage is Postgres. The MST itself isn't in
- Chapter 12
Account creation and did:plc
This is the longest single endpoint in the PDS. Registering an account
- Chapter 13
Authentication
Account creation handed back two JWTs. This chapter is about what those
- Chapter 14
Reading and writing records
Chapter 12 created the account and an empty repo. Chapter 13 made the
- Chapter 15
Blobs
A typical Bluesky post is a few hundred bytes of JSON. A single image
- Chapter 16
Event sequencer and the firehose
The firehose is the PDS's public stream. Every commit on every account on
- Chapter 17
PDS vs AppView vs Relay
You've built a PDS. By chapter 16 it owns repositories, signs commits,
- Chapter 18
Running in production
You've reached the end of the book with a working PDS. It signs commits,
- Chapter 19
Moderation
Chapter 18 ended the main book with a working production PDS and a list of
- Chapter 20
Migration
A user's DID lives on a third-party log (plc.directory) and points at a
- Chapter 21
OAuth
Chapter 13 handed clients a pair of HS256 JWTs whenever they typed the
- Chapter 22
A minimal client UI
So far in this book the PDS has been a server you talk to with curl. That's
- Chapter 23
Backups
The PDS is the only thing in the network that has a copy of every byte