Architecture โ
System Components โ
๐๏ธ
User PDS
pds.bsky.social
โ๏ธ
Stratos Service
API ยท OAuth ยท repo
๐
DID Resolver
PLC ยท did:web
๐ฆ
Blob Storage
disk or S3
๐ข๏ธ
PostgreSQL
indexed records
Data Flow โ
User Enrollment โ
๐ง
User
alice.bsky.social
โ๏ธ
Stratos Service
stratos.example.com
๐๏ธ
PDS
pds.bsky.social
๐
Signing Key
secp256k1
โ๏ธ
Attestation
didalice.bsky.social
keysecp256k1
sigโ by service
Record Creation โ
๐ป
Client App
createRecord
โ๏ธ
Stratos Service
validate ยท sign ยท MST
๐๏ธ
Actor Store
IPLD blocks ยท index
๐
User PDS
stub record
AppView Indexing โ
๐ฅ
PDS Firehose
subscribeRepos
โ๏ธ
Stratos Stream
subscribeRecords
๐
Indexer
stratos-indexer
๐ข๏ธ
PostgreSQL
stratos_post ยท boundaries
Repository & MST Architecture โ
Stratos maintains a per-user Merkle Search Tree (MST) and signed commit chain compatible with the ATProto repo format. Every record write produces a signed commit that updates the MST root, enabling cryptographic verification of repository contents.
| Layer | Contents |
|---|---|
| Signed Commit (v3) | did, version: 3, data (MST root CID), rev (TID), sig (P-256 signature) |
| MST | Sorted key-value tree mapping collection/rkey โ record CID |
| Endpoint | Description |
|---|---|
com.atproto.sync.getRecord | CAR with signed commit + MST inclusion proof + record block |
zone.stratos.sync.getRepo | Full repo as a CAR file |
zone.stratos.repo.importRepo | Import repo from CAR with CID integrity verification |
Storage Architecture โ
Each enrolled user gets either an isolated SQLite database (default) or an isolated PostgreSQL schema.
SQLite layout:
/data/stratos/
โโโ service.sqlite # Enrollment, OAuth sessions
โโโ blobs/ # Blob storage (local provider)
โ โโโ {did}/{cid}
โ โโโ temp/{did}/{key}
โ โโโ quarantine/{did}/{cid}
โโโ actors/
โโโ ab/
โ โโโ did:plc:abc123/
โ โโโ stratos.sqlite # Records, repo blocks
โโโ cd/
โโโ did:plc:cdef456/
โโโ stratos.sqliteDatabase Schema โ
stratos_record โ record metadata
sql
CREATE TABLE stratos_record (
uri TEXT PRIMARY KEY,
cid TEXT NOT NULL,
collection TEXT NOT NULL,
rkey TEXT NOT NULL,
repoRev TEXT,
indexedAt TEXT NOT NULL,
takedownRef TEXT
);stratos_seq โ event sequencing for subscriptions
sql
CREATE TABLE stratos_seq (
seq INTEGER PRIMARY KEY AUTOINCREMENT,
did TEXT NOT NULL,
time TEXT NOT NULL,
rev TEXT NOT NULL,
event TEXT NOT NULL -- JSON-encoded operation
);