ATProtoNet (0.4.0)

Published 2026-05-26 01:18:56 +00:00 by Grandiras in Grandiras/ATProto.NET

Installation

dotnet nuget add source --name Grandiras --username your_username --password your_token 
dotnet add package --source Grandiras --version 0.4.0 ATProtoNet

About this package

A comprehensive .NET SDK for the AT Protocol — build custom AT Proto apps with typed records, XRPC, and full repository CRUD.

ATProto.NET

CI

A comprehensive .NET 10 SDK for the AT Protocol. Build custom AT Protocol applications with your own Lexicon schemas, interact with Bluesky, or host your own PDS — all from clean, modern .NET APIs.

Source: Forgejo (canonical) · GitHub (mirror — issues & PRs welcome here)

⚠️ This repository was mainly built by a coding agent. Thorough testing has been conducted, and the maintainer (Grandiras) is a human.

Why ATProto.NET?

The AT Protocol isn't just Bluesky — it's an open protocol where one account works across many apps. Each app defines its own Lexicon schemas and stores records in the user's Personal Data Server (PDS). ATProto.NET makes it easy to build these custom applications in .NET.

The SDK is in 0.* because, while it's near feature-complete, it's mostly vibe-coded and won't be called "stable" until it has been put through real use. There's no fixed timeline for 1.0 — the more this project gets exercised, the sooner it happens.

At a glance

  • Custom Lexicon supportRecordCollection<T> for typed CRUD on your own record schemas, plus QueryAsync<T> / ProcedureAsync<T> for custom XRPC methods.
  • OAuth & identity — full AT Protocol OAuth (DPoP, PAR, PKCE), did:plc / did:web resolution, type-safe Did / Handle / AtUri / Nsid / Tid / RecordKey / Cid.
  • Bluesky, Chat, Ozoneapp.bsky.* (actors, feeds, graph, notifications, rich text, video), chat.bsky.* (conversations, DMs), tools.ozone.* (moderation).
  • Hosting — ASP.NET Core DI + JWT auth, Blazor components with cookie-based OAuth, .NET Aspire integration, and host your own PDS in-process via ATProtoNet.Pds.
  • Repository internals — typed firehose consumer with CID/signature verification, MST, CAR v1 parsing, DAG-CBOR, PLC directory client, P-256/K-256 crypto.
  • Lexicon toolingatproto-lexgen dotnet tool for bidirectional Lexicon JSON ↔ C#, schema diffing, and publishing.

Install

dotnet add package ATProtoNet

Additional packages (ATProtoNet.Server, ATProtoNet.Blazor, ATProtoNet.Aspire, ATProtoNet.Pds, ATProtoNet.Server.EntityFrameworkCore) and the atproto-lexgen dotnet tool are documented in the full package matrix.

A 30-second taste

The headline feature is RecordCollection<T> — strongly-typed CRUD on your own Lexicon schemas, stored in the user's PDS:

using ATProtoNet;
using System.Text.Json.Serialization;

// 1. Define your record type
public class TodoItem : AtProtoRecord
{
    public override string Type => "com.example.todo.item";

    [JsonPropertyName("title")]     public string Title { get; set; } = "";
    [JsonPropertyName("completed")] public bool Completed { get; set; }
}

// 2. Connect and authenticate
var client = new AtProtoClientBuilder()
    .WithInstanceUrl("https://bsky.social")
    .Build();
await client.LoginAsync("alice.bsky.social", "app-password");

// 3. Get a typed collection and do CRUD
var todos = client.GetCollection<TodoItem>("com.example.todo.item");

var created = await todos.CreateAsync(new TodoItem { Title = "Buy groceries" });

await foreach (var record in todos.EnumerateAsync())
    Console.WriteLine($"[{(record.Value.Completed ? "x" : " ")}] {record.Value.Title}");

One AT Protocol account can power many such apps — todos, bookmarks, recipes, whatever — each with its own Lexicons, all stored in the same user's PDS.

Where to go next

If you want to… Read
Install, configure the client, and authenticate Getting Started
Build your own AT Protocol app with custom records Custom Lexicon Records
Use OAuth (recommended for user-facing apps) OAuth Authentication
Wire AT Proto into an ASP.NET / Blazor backend ASP.NET Core, Blazor
Consume the firehose with typed events Firehose Streaming
Host your own PDS PDS Hosting
Understand how the packages compose Architecture
Everything else docs/index.md

Contributing

Issues and pull requests are welcome on GitHub (mirrored from Forgejo). See CONTRIBUTING.md for the dev setup, test workflow, and conventions.

License

MIT.

Dependencies

ID Version Target Framework
Microsoft.Extensions.Http 10.0.0 net10.0
Microsoft.Extensions.Logging.Abstractions 10.0.0 net10.0
Microsoft.Extensions.Options 10.0.0 net10.0
System.Formats.Cbor 9.0.4 net10.0
Details
NuGet
2026-05-26 01:18:56 +00:00
8
Grandiras
262 KiB
Assets (2)
Versions (5) View all
0.4.0 2026-05-26
0.3.0 2026-02-21
0.2.0 2026-02-20
0.1.1 2026-02-20
0.1.0 2026-02-19