This is a Rust port of dnproto, which is an atproto PDS.
My main account runs on rustproto -> threddyrex.org.
For info on how to implement a PDS from scratch, check out Ten Steps to a PDS.
CAR repo encoding and decoding:
- repo/mod.rs - repo module - explains repo structure ⭐
- dag_cbor.rs - decoding/encoding dag cbor ⭐
- cid.rs - decoding/encoding cid
- varint.rs - decoding/encoding varint
MST data structure:
- mst.rs - MST
- mst_node.rs - represents one node in the MST
- mst_entry.rs - represents one entry in a MST node
PDS implementation:
- /xrpc/ - the XRPC endpoints
- installer.rs - installing the PDS
- server.rs - PDS entry point
- db/ - the database interface, where the repo is stored
- repo_mst.rs - converting MST into dag-cbor for use in repos
- user_repo.rs - operations on the user's repo
Listening to a firehose:
General Bluesky WS calls:
- bluesky_client.rs - calling the Bluesky API.
The following steps show how to use the command line tool on Windows in PowerShell. Requires Rust.
To get started, change into the root directory and build.
cargo buildNext, change into the scripts directory, and list the files:
cd powershell
lsMost of the files in this directory represent one "command" of the tool. Here are the available commands:
# resolve actor info and retrieve did, did doc
.\ResolveActorInfo.ps1 -actor <handle or did>
# download the user's repo and store in the data directory
.\GetRepo.ps1 -actor <handle or did>
# print stats for the downloaded repo
.\PrintRepoStats.ps1 -actor <handle or did>
# print records for the downloaded repo
.\PrintRepoRecords.ps1 -actor <handle or did>
# walk the MST for the downloaded repo
.\WalkMst.ps1 -actor <handle or did>
# start listening to a firehose
.\StartFirehoseConsumer.ps1
When you are using the command line tool, it uses a local directory to store cached data. By default, it uses the "data" directory in the repo. You can change this in the _Defaults.ps1 file.
Is Linux supported? Yes! I run my rustproto PDS on Linux.