Go boilerplate library for building atproto apps
atproto go
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Go 100.0%
9 1 0

Clone this repository

https://tangled.org/pdewey.com/atp https://tangled.org/did:plc:hm5f3dnm6jdhrc55qp2npdja/atp
git@tangled.org:pdewey.com/atp git@tangled.org:did:plc:hm5f3dnm6jdhrc55qp2npdja/atp

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

atp#

AT Protocol boilerplate for Go, extracted from arabica.social. Covers OAuth flows, PDS client operations, real-time event consumption, session storage, and HTTP middleware.

For integration testing against an ephemeral in-process PDS, see chrysalis.

Installation#

go get tangled.org/pdewey.com/atp@latest

Packages#

Root (atp)#

Core types and clients for the AT Protocol.

  • Client -- authenticated PDS client for CRUD operations on a user's repository (CreateRecord, GetRecord, ListRecords, PutRecord, DeleteRecord, UploadBlob, GetBlob).
  • OAuthApp -- manages the OAuth flow: login (browser-based and CLI), callback handling, session resumption, and logout. Supports public and localhost (development) client modes.
  • PublicClient -- unauthenticated access to public atproto APIs (handle resolution, profiles, record reads) with SSRF protection.
  • Helpers for AT-URI parsing/building, scope construction, and error handling.

jetstream#

WebSocket consumer for the Jetstream relay. Reconnects with exponential backoff, rotates endpoints, optionally decompresses zstd, and persists cursors for resuming after restarts.

middleware#

Cookie-based AT Protocol auth middleware. Validates sessions against the OAuth store and injects the authenticated DID into the request context. Also serves the OAuth client metadata endpoint.

store/bolt and store/sqlite#

Two oauth.ClientAuthStore implementations for persisting OAuth sessions and auth request state:

  • bolt: BoltDB-backed.
  • sqlite: SQLite-backed with automatic schema migration and expired request cleanup.

tracing#

OpenTelemetry span helpers for AT Protocol operations (PDS calls, database operations, HTTP handlers). Sets up an OTLP HTTP exporter and returns no-op spans when there is no active trace context.