AT Protocol TypeScript Reference Implementation

repository·main·Indexed 27 days ago

https://github.com/bluesky-social/atproto

The TypeScript reference implementation of the AT Protocol (atproto), a decentralized social media protocol. It provides core libraries, services (PDS and AppView), and lexicons for building social applications like Bluesky. Key packages include @atproto/api for client interaction, @atproto/crypto for P-256 and K-256 cryptographic operations, @atproto/bsky for Bluesky service logic, and @atproto/aws for AWS KMS Keypair compatibility.

Tokens
88.6K
Snippets
177
Records
558
Agent score
94%

What's inside atproto

  1. Overview of @atproto/repo

    main
    The @atproto/repo package is a TypeScript library designed for managing atproto repositories. It provides implementations for the Merkle Search Tree (MST) data structure, which is used to maintain the signed key/value stores that form the basis of atproto repositories. These repositories contain CBOR-encoded data records. For detailed structural constraints, MST node formats, and serialization details, refer to the official AT Protocol repository specification.
  2. Overview of AT Protocol TypeScript Packages

    main

    The atproto repository provides several TypeScript packages for building on the AT Protocol. Key packages include:

    • @atproto/api: The primary client library.
    • @atproto/common-web: Shared code and helpers for web browsers.
    • @atproto/common: Shared code and helpers for non-browser environments.
    • @atproto/crypto: Cryptographic signing and key serialization.
    • @atproto/identity: DID and handle resolution.
    • @atproto/lex: A modern, type-safe client library utilizing code generation.
    • @atproto/lexicon: The schema definition language.
    • @atproto/repo: Data storage structures, including MST.
    • @atproto/syntax: String parsers for identifiers.
    • @atproto/xrpc: Client-side HTTP API helpers.
    • @atproto/xrpc-server: Server-side HTTP API helpers.
  3. Overview of atproto packages

    main

    The atproto repository contains several applications and libraries for building on the AT Protocol:

    Applications

    • PDS: The Personal Data Server, the main server-side implementation.
    • Dev Env: A CLI tool for managing development environments.
    • Lexicon CLI: A CLI tool for generating code and documentation from Lexicon schemas.

    Libraries

    • @atproto/api: Library for communicating with atproto servers.
    • @atproto/common: Shared code used across atproto packages.
    • @atproto/crypto: Common cryptographic operations.
    • @atproto/syntax: Handles identifier syntax like NSID, AT URI, and handles.
    • @atproto/lexicon: Data validation using the atproto schema system.
    • @atproto/oauth-provider: Support for ATPROTO's OAuth.
    • @atproto/repo: Core implementation of the atproto repository (Merkle Search Tree).
    • @atproto/ws-client: Long-lived WebSocket client connections.
    • @atproto/xrpc: XRPC client implementation.
    • @atproto/xrpc-server: XRPC server implementation.
  4. Understand AT Protocol Services and Lexicons

    main

    The AT Protocol implementation includes core services and schema definitions:

    Services

    • pds (Personal Data Server): Hosts repository content for atproto accounts. Implementation is in packages/pds with a runtime wrapper in services/pds.
    • bsky (AppView): Implements the app.bsky.* API endpoints. Implementation is in packages/bsky with a runtime wrapper in services/bsky.

    Lexicons

    Lexicons define the schemas for com.atproto.* and app.bsky.* namespaces. They are stored as JSON files in the ./lexicons/ directory and follow the Lexicon schema definition language.

  5. Use IndexedDB utilities for browser data storage

    main

    The packages/oauth/oauth-client-browser/src/indexed-db module provides a small wrapper around the native IndexedDB API. It simplifies the process of storing and retrieving data from an IndexedDB database within a browser environment.

    Note: This utility is currently intended for internal use within the @atproto/oauth-client-browser package and is not maintained as a standalone library.