ATProtoNet 0.6.0
dotnet add package ATProtoNet --version 0.6.0
NuGet\Install-Package ATProtoNet -Version 0.6.0
<PackageReference Include="ATProtoNet" Version="0.6.0" />
<PackageVersion Include="ATProtoNet" Version="0.6.0" />
<PackageReference Include="ATProtoNet" />
paket add ATProtoNet --version 0.6.0
#r "nuget: ATProtoNet, 0.6.0"
#:package ATProtoNet@0.6.0
#addin nuget:?package=ATProtoNet&version=0.6.0
#tool nuget:?package=ATProtoNet&version=0.6.0
ATProto.NET
A comprehensive .NET 10 SDK for the AT Protocol. Build custom AT Protocol applications with your own Lexicon schemas, interact with Bluesky, or run your own managed 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 support —
RecordCollection<T>for typed CRUD on your own record schemas, plusQueryAsync<T>/ProcedureAsync<T>for custom XRPC methods. - OAuth & identity — full AT Protocol OAuth (DPoP, PAR, PKCE),
did:plc/did:webresolution, type-safeDid/Handle/AtUri/Nsid/Tid/RecordKey/Cid. - Bluesky, Chat, Ozone —
app.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 a managed PDS — run the official Bluesky PDS or Tranquil PDS container via
ATProtoNet.Aspire.Hostingand administer it withPdsAdminClient. - Streaming — typed firehose consumer with CID/signature verification, plus a Jetstream consumer (v1 and v2 wire protocols) with server-side collection/DID/kind filtering; both with reconnect and cursor persistence. Jetstream v2 also backfills from the network archive and cuts over into the live tail with no gap.
- Spaces (permissioned data, alpha) — AT Protocol's second data protocol: access-controlled
space:records with LtHash set-hash commits, DPoP-bound space credentials, incremental sync with full-state recovery, andsimplespacemanagement — on both sides, withATProtoNet.Serverserving a space as an authority or a repo host. See Spaces. - Repository internals — MST (including covering proofs), CAR v1 read and write, DAG-CBOR, signed commit objects,
did:plcoperation building, PLC directory client, P-256/K-256 crypto. - Lexicon tooling —
atproto-lexgendotnet toolfor bidirectional Lexicon JSON ↔ C#, schema diffing, and publishing.
Install
dotnet add package ATProtoNet
Additional packages (ATProtoNet.Server — ASP.NET Core integration including the EF Core token store and Aspire client integration, ATProtoNet.Blazor, ATProtoNet.Aspire.Hosting) 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
{
[JsonPropertyName("$type")]
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 |
| Store private, gated, or group data | Spaces (Permissioned Data) |
| Consume the firehose with typed events | Firehose Streaming |
| Index a few collections cheaply over JSON | Jetstream Streaming |
| Backfill history, then keep tailing live | Jetstream Historical Replay |
| Run your own PDS | Managed PDS |
| 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.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.Http (>= 10.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Options (>= 10.0.10)
- System.Formats.Cbor (>= 10.0.10)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on ATProtoNet:
| Package | Downloads |
|---|---|
|
ATProtoNet.Server
ASP.NET Core integration for ATProtoNet — dependency injection, authentication, middleware, EF Core and Redis stores, and .NET Aspire client integration (health checks and resilience) for AT Protocol applications. |
|
|
ATProtoNet.Blazor
Blazor components and services for AT Protocol applications — login forms, profile cards, feeds, and auth state integration. |
|
|
ATProtoNet.Server.EntityFrameworkCore
Entity Framework Core token store for ATProtoNet — persist OAuth tokens in any EF Core-supported database (SQL Server, PostgreSQL, SQLite, etc.). |
|
|
ATProtoNet.Aspire
Aspire integration for ATProto.NET — registers AtProtoClient as a shared service with health checks, resilience, and OpenTelemetry. |
GitHub repositories
This package is not used by any popular GitHub repositories.