Skip to main content

@atproto/bsky

TypeScript implementation of the app.bsky Lexicons backing the Bluesky microblogging application. This package provides the AppView service that aggregates data from Personal Data Servers and serves the Bluesky API.

Installation

Overview

The Bluesky AppView is a service that:
  • Indexes data from multiple PDSs via the data plane
  • Provides the app.bsky.* Lexicon endpoints
  • Implements social graph algorithms (feeds, notifications, suggestions)
  • Manages content moderation and labeling
  • Handles blob/media serving and transformation
  • Provides search functionality
Architecture:
  • AppView: Public-facing API service
  • Data Plane: Backend indexing and data aggregation
  • Hydrator: Enriches data with additional context
  • Views: Formats data for API responses

Main Exports

BskyAppView Class

The main AppView server class.

Methods

static create(opts: { config: ServerConfig; signingKey: Keypair }): BskyAppView Creates a new AppView instance. async start(): Promise<http.Server> Starts the AppView server and establishes connections to dependencies. async destroy(): Promise<void> Gracefully shuts down the server.

ServerConfig Class

Configuration management for the AppView.

AppContext

Application context with shared services.

Configuration

ServerConfigValues

Complete configuration interface:

Environment Variables

Service Configuration

Data Plane

Sync Service (Bsync)

External Services

CDN and Media

Identity

Moderation

Threading

Feature Flags

GrowthBook (A/B Testing)

Setup Example

Data Plane Client

The AppView communicates with the data plane for indexed data:

Hydrator

The hydrator enriches data with additional context:

Views

Views format hydrated data for API responses:

Authentication

The AppView validates requests using JWT tokens:

Feature Gates

A/B testing and feature flags via GrowthBook:

API Routes

The AppView implements all app.bsky.* Lexicons:

Blob Serving

The AppView serves images and videos:

Database (Data Plane)

The data plane manages the indexed database:

Resources