FSharp.ATProto
A native F# library for the AT Protocol and Bluesky. Pure F#, no C# wrappers. Immutable domain types, result-based error handling, and a convenience API that makes the protocol disappear -- you think in posts, profiles, and follows, not records and XRPC calls.
open FSharp.ATProto.Bluesky
taskResult {
let! agent = Bluesky.login "https://bsky.social" "handle.bsky.social" "app-password"
let! post = Bluesky.post agent "Hello from F#! #atproto"
printfn "Posted: %s" (AtUri.value post.Uri)
return post
}
Getting Started
Add a project reference to FSharp.ATProto.Bluesky -- it pulls in all dependencies transitively. Then head to the Quickstart to go from zero to first post in five minutes.
- Quickstart — authenticate and make your first post
- Build a Bot — full bot example with notifications and replies
- Concepts — domain types, SRTP, and design philosophy
- Error Handling — taskResult CE and error patterns
Type Reference
- Posts — creating, reading, and engaging with posts
- Profiles — reading and searching user profiles
- Social Actions — following, blocking, and undo operations
- Feeds — timelines, author feeds, and pagination
- Chat — direct messaging conversations
- Notifications — reading and managing notifications
- Lists — list and starter pack management
- Preferences — saved feeds, muted words, content filtering
Advanced Guides
- Media — uploading images, video, and blobs
- Rich Text — mentions, links, hashtags, and text manipulation
- Identity — DID resolution and handle verification
- Moderation — muting, reporting, and the moderation engine
- Pagination — IAsyncEnumerable-based paginators
- Raw XRPC — direct XRPC calls for uncovered endpoints
- Streaming — real-time event streams via Jetstream and Firehose
- Ozone — moderation tooling for labeler operators
- Account — account creation, deletion, and session management
Server-Side
- Feed Generator — build custom feed algorithms
- XRPC Server — host AT Protocol endpoints
- OAuth — OAuth client and authorization server
Infrastructure
- Cryptography — P-256/K-256 keys, signing, did:key encoding
- Repository — MST, signed commits, CAR export
- Service Auth — inter-service JWT authentication
- PLC Directory — DID PLC resolution and operations
- Testing — TestFactory for unit testing
Architecture
The library is organized in layers, each building on the one below:
Package |
Purpose |
|---|---|
|
Identifier types (DID, Handle, NSID, AT-URI, etc.) |
|
CBOR encoding, CID computation, data integrity |
|
Lexicon schema parser and record validator |
|
XRPC client, session auth, rate limiting, pagination |
|
Generated types, rich text, identity, convenience methods |
|
Jetstream and Firehose event streams |
|
Label-aware moderation engine |
|
Custom feed generator framework |
|
OAuth 2.0 client with DPoP and PKCE |
|
OAuth 2.0 authorization server |
|
Cryptographic keys, signing, did:key |
|
Repository MST, commits, CAR export |
|
XRPC server framework with auth and rate limiting |
across 14 projects.
License
MIT
namespace Microsoft.FSharp
--------------------
namespace FSharp