Architecture Overview - shahmal1yev/blueskysdk GitHub Wiki

Lexicon Structure

The SDK adopts a well-organized namespace structure, mirroring the AT Protocol's hierarchy:

use Atproto\Lexicons\{
    App\Bsky\Feed\Post,           // app.bsky.feed.post
    App\Bsky\Actor\Profile,       // app.bsky.actor.profile
    Com\Atproto\Repo\CreateRecord // com.atproto.repo.createRecord
};

Namespaced Identifiers (NSID)

Each operation corresponds to a specific NSID in the AT Protocol. Examples:

- app.bsky.feed.post            -> Atproto\Lexicons\App\Bsky\Feed\Post
- app.bsky.actor.getProfile     -> Atproto\Lexicons\App\Bsky\Actor\GetProfile

Smart Builder Pattern

The SDK supports method chaining for intuitive API requests:

$response = $client->com()      // Navigate to 'com' namespace
    ->atproto()                 // Navigate to 'atproto' subspace
    ->repo()                    // Navigate to 'repo' operations
    ->createRecord()            // Select 'createRecord' operation
    ->forge()                   // Initialize the request builder
    ->record($post)             // Add content
    ->send();                   // Execute the request