Skip to content

Instantly share code, notes, and snippets.

@mikestaub
Last active August 31, 2024 19:08
Show Gist options
  • Save mikestaub/376df1f574abab64bf4a0778d3a75b31 to your computer and use it in GitHub Desktop.
Save mikestaub/376df1f574abab64bf4a0778d3a75b31 to your computer and use it in GitHub Desktop.
ilograph.com diagrams for atproto.com
# use https://app.ilograph.com to edit and view this document
# tutorials are here https://www.ilograph.com/docs/editing/tutorial/#making-some-simple-changes
# author: Mike Staub <[email protected]>
# Lexicons are here: https://rdmurphy.github.io/atproto-openapi-types
# Learn more about atproto.com here: https://github.com/atproto-developers
description: |-
Architecture and sequence diagrams for the ATprotocol and Bluesky social app network. Generated from source code and whitepaper reference. https://arxiv.org/pdf/2402.03239
resources:
- id: User
name: User
icon: AWS/_General/User.svg
color: DarkGoldenrod
- id: Moderator
name: Moderator
color: DarkGoldenrod
- id: Bot
name: Automated Bot
description: Code [code](https://github.com/bluesky-social/bsky-docs/blob/HEAD/docs/starter-templates/bots.mdx)
color: DarkGoldenrod
- id: ClientApp
name: Client Application
color: Firebrick
description: Code [source](https://github.com/bluesky-social/atproto/blob/HEAD/packages/api/OAUTH.md)
- id: AuthServer
name: Authorization Server
color: blue
description: Code [source](https://github.com/bluesky-social/atproto/blob/HEAD/packages/oauth/oauth-provider/src/index.ts)
- id: SocialApp
name: Social-App
color: Firebrick
description: Code [source](https://github.com/bluesky-social/social-app)
- id: PDS
name: Personal Data Server (PDS)
color: blue
description: Code [source](https://github.com/bluesky-social/pds/blob/HEAD/Dockerfile)
- id: PDS1
name: Personal Data Server 1 (PDS1)
color: blue
description: Code [source](https://github.com/bluesky-social/pds/blob/HEAD/Dockerfile)
- id: PDS2
name: Personal Data Server 2 (PDS2)
color: blue
description: Code [source](https://github.com/bluesky-social/pds/blob/HEAD/Dockerfile)
- id: Relay
name: Relay
color: blue
description: Code [source](https://github.com/bluesky-social/atproto/blob/HEAD/services/bsync/Dockerfile)
- id: AppView
name: App View
color: blue
description: Code [source](https://github.com/bluesky-social/atproto/blob/HEAD/services/bsky/Dockerfile)
- id: LabelingService
name: Labeling Service
color: blue
description: Code [source](https://github.com/bluesky-social/atproto/blob/main/lexicons/app/bsky/labeler/defs.json)
- id: FeedGen
name: Feed Generator
color: blue
description: Code [source](https://github.com/bluesky-social/atproto/blob/HEAD/packages/bsky/src/data-plane/server/db/tables/feed-generator.ts)
- id: OzoneUI
name: Ozone UI
color: Firebrick
description: Code [code](https://github.com/bluesky-social/ozone/blob/HEAD/components/shell/ConfigurationFlow.tsx)
- id: OzoneService
name: Ozone Service
color: blue
description: Code [code](https://github.com/bluesky-social/ozone/blob/HEAD/Dockerfile)
- id: NotificationService
name: Notification Service
color: blue
description: Code [code](https://github.com/bluesky-social/atproto/blob/HEAD/packages/bsky/src/data-plane/server/db/tables/notification.ts)
- id: PLCService
name: PLC Service
color: blue
description: Code [source](https://github.com/bluesky-social/atproto/blob/HEAD/packages/dev-env/src/plc.ts)
- id: EmailService
name: Email Service
color: blue
description: Code [source](https://github.com/bluesky-social/atproto/blob/HEAD/packages/pds/src/mailer/index.ts)
perspectives:
- name: Protocol Overview
relations:
- from: User
to: PDS
label: "Submit Account Creation Request"
- from: PDS
to: PLCService
label: "Generate DID and PLC Operation"
- from: PLCService
to: PDS
label: "Return DID and PLC Operation"
- from: PDS
to: EmailService
label: "Send Verification Email"
- from: EmailService
to: User
label: "Receive Verification Email"
- from: User
to: EmailService
label: "Verify Email"
- from: EmailService
to: PDS
label: "Confirm Email Verification"
- from: PDS
to: PLCService
label: "Submit PLC Operation"
- from: PLCService
to: PDS
label: "Confirm PLC Operation"
- from: PDS
to: User
label: "Account Creation Successful"
- from: User
to: SocialApp
label: "Request Feed Data"
- from: SocialApp
to: AppView
label: "Fetch Feed Data"
- from: AppView
to: Relay
label: "Request Latest Data"
- from: Relay
to: FeedGen
label: "Broadcast Data"
- from: FeedGen
to: Relay
label: "Read Data from Relay"
- from: FeedGen
to: Relay
label: "Send Processed Feed Data"
- from: Relay
to: AppView
label: "Send Aggregated Data"
- from: AppView
to: SocialApp
label: "Send Feed Data"
- from: SocialApp
to: User
label: "Display Feed Data"
- from: User
to: SocialApp
label: "Submit Post"
- from: SocialApp
to: PDS
label: "Send Post Data"
- from: PDS
to: PDS
label: "Store Post Data"
- from: PDS
to: PDS
label: "Sign Post Data"
- from: PDS
to: Relay
label: "Notify Relay"
- from: Relay
to: PDS
label: "Crawl Data"
- from: Relay
to: Relay
label: "Aggregate Data"
- from: Relay
to: AppView
label: "Broadcast Data"
- from: AppView
to: AppView
label: "Process Data"
- from: AppView
to: SocialApp
label: "Update User Interface"
- from: Relay
to: FeedGen
label: "Broadcast Data"
- from: FeedGen
to: FeedGen
label: "Create Custom Feeds"
- from: User
to: PDS
label: "Discover Labeling Services"
- from: User
to: LabelingService
label: "Send Subscription Request"
- from: LabelingService
to: LabelingService
label: "Confirm Subscription"
- from: LabelingService
to: User
label: "Provide Configuration Options"
- from: User
to: LabelingService
label: "Set Preferences"
- from: LabelingService
to: PDS
label: "Sync Labels"
- from: PDS
to: AppView
label: "Sync Labels"
- from: AppView
to: AppView
label: "Interpret Labels"
- from: AppView
to: User
label: "Display Labeled Content"
- from: User
to: OzoneUI
label: "Report Content"
- from: OzoneUI
to: OzoneService
label: "Submit Report"
- from: OzoneService
to: OzoneService
label: "Queue Report"
- from: OzoneService
to: Moderator
label: "Notify Moderator"
- from: Moderator
to: OzoneService
label: "Review Report"
- from: Moderator
to: OzoneService
label: "Take Action"
- from: OzoneService
to: OzoneService
label: "Update State"
- from: OzoneService
to: NotificationService
label: "Notify User and Content Creator"
- from: NotificationService
to: User
label: "Send Notification"
- from: NotificationService
to: User
label: "Send Notification to Content Creator"
- from: Bot
to: PDS
label: "Authenticate"
- from: PDS
to: Bot
label: "Return Session Token"
- from: Bot
to: PDS
label: "Post Data"
- from: PDS
to: PDS
label: "Store Data"
- from: PDS
to: Relay
label: "Notify Relay"
- from: Relay
to: Relay
label: "Crawl Data"
- from: Relay
to: AppView
label: "Broadcast Data"
- from: AppView
to: AppView
label: "Process Data"
- from: AppView
to: User
label: "Display Data"
- from: User
to: PDS1
label: "Create/Update Data"
- from: PDS1
to: PDS1
label: "Store Data"
- from: PDS1
to: Relay
label: "Notify Relay"
- from: Relay
to: PDS1
label: "Crawl Data"
- from: Relay
to: PDS2
label: "Crawl Data"
- from: Relay
to: AppView
label: "Broadcast Data"
- from: PDS2
to: PDS2
label: "Store Data"
- from: AppView
to: AppView
label: "Aggregate Data"
- from: AppView
to: User
label: "Display Data"
- from: User
to: ClientApp
label: "Initiate Authorization Request"
- from: ClientApp
to: AuthServer
label: "Redirect to Authorization Endpoint"
- from: AuthServer
to: User
label: "Prompt for User Credentials"
- from: User
to: AuthServer
label: "Submit Credentials"
- from: AuthServer
to: ClientApp
label: "Redirect with Authorization Code"
- from: ClientApp
to: AuthServer
label: "Exchange Authorization Code for Access Token"
- from: AuthServer
to: ClientApp
label: "Return Access Token"
- from: ClientApp
to: PDS
label: "Access Protected Resource with Access Token"
- from: PDS
to: ClientApp
label: "Return Protected Resource"
- from: ClientApp
to: User
label: "Display Protected Resource"
walkthrough:
- text: "Welcome to the Protocol Overview walkthrough. Let's start by introducing the key resources. \n\nNote: the only resources that are still under centralized control are PLC, AppView, and Authorization Server, all of which have plausible paths to decentralization. All others can be run by anyone.\n\nColor: \nblue = server component \nred = client application"
select: User
highlight: User
- text: "The User represents an individual interacting with the system."
select: User
highlight: User
- text: "The Personal Data Server (PDS) stores user data and handles requests."
select: PDS
highlight: PDS
- text: "The PLC Service generates and manages decentralized identifiers (DIDs)."
select: PLCService
highlight: PLCService
- text: "The Email Service handles email verification and notifications."
select: EmailService
highlight: EmailService
- text: "The Social-App is the main application where users interact with the social network."
select: SocialApp
highlight: SocialApp
- text: "The App View fetches and displays data to the user."
select: AppView
highlight: AppView
- text: "The Relay broadcasts data between services."
select: Relay
highlight: Relay
- text: "The Feed Generator creates custom feeds for users."
select: FeedGen
highlight: FeedGen
- text: "The Labeling Service manages content labels and preferences. See an example [here](https://github.com/haileyok/bsky-food-labeler/blob/main/src/Labeler.ts)"
select: LabelingService
highlight: LabelingService
- text: "The Ozone UI is the user interface for reporting content."
select: OzoneUI
highlight: OzoneUI
- text: "The Ozone Service processes content reports and moderation actions."
select: OzoneService
highlight: OzoneService
- text: "The Notification Service sends notifications to users."
select: NotificationService
highlight: NotificationService
- text: "Automated Bots interact with the system programmatically."
select: Bot
highlight: Bot
- text: "Client Applications initiate authorization requests."
select: ClientApp
highlight: ClientApp
- text: "The Authorization Server handles user authentication."
select: AuthServer
highlight: AuthServer
- text: "Personal Data Server 1 (PDS1) and Personal Data Server 2 (PDS2) are instances of PDS and can be hosted by anyone via [federation](https://bsky.social/about/blog/5-5-2023-federation-architecture)."
select: PDS1, PDS2
highlight: PDS1, PDS2
- text: "This concludes the Protocol Overview walkthrough. Click on other perspectives to dive deeper into the protocol."
select: User
highlight: User
- name: User Account Creation Using PLC Service
relations:
- from: User
to: PDS
label: "Submit Account Creation Request"
- from: PDS
to: PLCService
label: "Generate DID and PLC Operation"
- from: PLCService
to: PDS
label: "Return DID and PLC Operation"
- from: PDS
to: EmailService
label: "Send Verification Email"
- from: EmailService
to: User
label: "Receive Verification Email"
- from: User
to: EmailService
label: "Verify Email"
- from: EmailService
to: PDS
label: "Confirm Email Verification"
- from: PDS
to: PLCService
label: "Submit PLC Operation"
- from: PLCService
to: PDS
label: "Confirm PLC Operation"
- from: PDS
to: User
label: "Account Creation Successful"
- name: Social-App Feed Retrieval Sequence
relations:
- from: User
to: SocialApp
label: "Request Feed Data"
- from: SocialApp
to: AppView
label: "Fetch Feed Data"
- from: AppView
to: Relay
label: "Request Latest Data"
- from: Relay
to: FeedGen
label: "Broadcast Data"
- from: FeedGen
to: Relay
label: "Read Data from Relay"
- from: FeedGen
to: Relay
label: "Send Processed Feed Data"
- from: Relay
to: AppView
label: "Send Aggregated Data"
- from: AppView
to: SocialApp
label: "Send Feed Data"
- from: SocialApp
to: User
label: "Display Feed Data"
- name: Social-App Post Submission Sequence
relations:
- from: User
to: SocialApp
label: "Submit Post"
- from: SocialApp
to: PDS
label: "Send Post Data"
- from: PDS
to: PDS
label: "Store Post Data"
- from: PDS
to: PDS
label: "Sign Post Data"
- from: PDS
to: Relay
label: "Notify Relay"
- from: Relay
to: PDS
label: "Crawl Data"
- from: Relay
to: Relay
label: "Aggregate Data"
- from: Relay
to: AppView
label: "Broadcast Data"
- from: AppView
to: AppView
label: "Process Data"
- from: AppView
to: SocialApp
label: "Update User Interface"
- from: Relay
to: FeedGen
label: "Broadcast Data"
- from: FeedGen
to: FeedGen
label: "Create Custom Feeds"
- name: Subscribing to a Labeling Service
relations:
- from: User
to: PDS
label: "Discover Labeling Services"
- from: User
to: LabelingService
label: "Send Subscription Request"
- from: LabelingService
to: LabelingService
label: "Confirm Subscription"
- from: LabelingService
to: User
label: "Provide Configuration Options"
- from: User
to: LabelingService
label: "Set Preferences"
- from: LabelingService
to: PDS
label: "Sync Labels"
- from: PDS
to: AppView
label: "Sync Labels"
- from: AppView
to: AppView
label: "Interpret Labels"
- from: AppView
to: User
label: "Display Labeled Content"
- name: Moderation Actions
relations:
- from: Moderator
to: OzoneService
label: "Initiate Moderation Action"
- from: OzoneService
to: PDS
label: "Label Content"
condition: "Action is Label"
- from: OzoneService
to: AppView
label: "Update Label in AppView"
condition: "Action is Label"
- from: OzoneService
to: Relay
label: "Take Down Content"
condition: "Action is Takedown"
- from: OzoneService
to: AppView
label: "Remove Content from AppView"
condition: "Action is Takedown"
- from: OzoneService
to: Moderator
label: "Escalate Report"
condition: "Action is Escalation"
- from: OzoneService
to: PDS
label: "Mute Content"
condition: "Action is Mute"
- from: OzoneService
to: Moderator
label: "Add Comment"
condition: "Action is Comment"
- from: OzoneService
to: NotificationService
label: "Send Notification"
condition: "Any Action"
- name: Automated Bot Writing Data Sequence
relations:
- from: Bot
to: PDS
label: "Authenticate"
- from: PDS
to: Bot
label: "Return Session Token"
- from: Bot
to: PDS
label: "Post Data"
- from: PDS
to: PDS
label: "Store Data"
- from: PDS
to: Relay
label: "Notify Relay"
- from: Relay
to: PDS
label: "Crawl Data"
- from: Relay
to: AppView
label: "Broadcast Data"
- from: AppView
to: AppView
label: "Process Data"
- from: AppView
to: User
label: "Display Data"
- name: Basic OAuth Flow
relations:
- from: User
to: ClientApp
label: "Initiate Authorization Request"
- from: ClientApp
to: AuthServer
label: "Redirect to Authorization Endpoint"
- from: AuthServer
to: User
label: "Prompt for User Credentials"
- from: User
to: AuthServer
label: "Submit Credentials"
- from: AuthServer
to: ClientApp
label: "Redirect with Authorization Code"
- from: ClientApp
to: AuthServer
label: "Exchange Authorization Code for Access Token"
- from: AuthServer
to: ClientApp
label: "Return Access Token"
- from: ClientApp
to: PDS
label: "Access Protected Resource with Access Token"
- from: PDS
to: ClientApp
label: "Return Protected Resource"
- from: ClientApp
to: User
label: "Display Protected Resource"
- name: Federation and Data Synchronization
relations:
- from: User
to: PDS1
label: "Create/Update Data"
- from: PDS1
to: PDS1
label: "Store Data"
- from: PDS1
to: Relay
label: "Notify Relay"
- from: Relay
to: PDS1
label: "Crawl Data"
- from: Relay
to: PDS2
label: "CrawlData"
- from: Relay
to: AppView
label: "Broadcast Data"
- from: PDS2
to: PDS2
label: "Store Data"
- from: AppView
to: AppView
label: "Aggregate Data"
- from: AppView
to: User
label: "Display Data"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment