Skip to content

Architecture โ€‹

System Components โ€‹

๐Ÿ—„๏ธ
User PDS
pds.bsky.social
โš™๏ธ
Stratos Service
API ยท OAuth ยท repo
๐Ÿ“ก
AppView
zone.stratos.feed.*
๐Ÿ”
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

Private feed storage โ€‹

The feed generator collects posts hosted by Stratos and protected posts from PDS users whom Stratos lists as members. It checks each PDS user's signed update before adding those posts to its encrypted local database. A viewer can read posts and attachments only from boundaries they currently belong to. See Feed Generator for storage, access, and startup checks.

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.

LayerContents
Signed Commit (v3)did, version: 3, data (MST root CID), rev (TID), sig (P-256 signature)
MSTSorted key-value tree mapping collection/rkey โ†’ record CID
EndpointDescription
com.atproto.sync.getRecordCAR with signed commit + MST inclusion proof + record block
zone.stratos.sync.getRepoFull repo as a CAR file
zone.stratos.repo.importRepoImport 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:

text
/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.sqlite

Database 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
);