MCPcopy Index your code
hub / github.com/bluesky-social/atproto

github.com/bluesky-social/atproto @main sqlite

repository ↗ · DeepWiki ↗
8,286 symbols 29,059 edges 2,209 files 324 documented · 4%
README

AT Protocol Reference Implementation (TypeScript)

Welcome friends!

This repository contains Bluesky's reference implementation of AT Protocol, and of the app.bsky microblogging application service backend.

What is in here?

TypeScript Packages:

Package Docs NPMX
@atproto/api: client library README NPM
@atproto/common-web: shared code and helpers which can run in web browsers README NPM
@atproto/common: shared code and helpers which doesn't work in web browsers README NPM
@atproto/crypto: cryptographic signing and key serialization README NPM
@atproto/identity: DID and handle resolution README NPM
@atproto/lex: modern type-safe client library with codegen README NPM
@atproto/lexicon: schema definition language README NPM
@atproto/repo: data storage structure, including MST README NPM
@atproto/syntax: string parsers for identifiers README NPM
@atproto/xrpc: client-side HTTP API helpers README NPM
@atproto/xrpc-server: server-side HTTP API helpers README NPM

TypeScript Services:

  • pds: "Personal Data Server", hosting repo content for atproto accounts. Most implementation code in packages/pds, with runtime wrapper in services/pds. See bluesky-social/pds for directions on self-hosting.
  • bsky: AppView implementation of the app.bsky.* API endpoints. Running on main network at api.bsky.app. Most implementation code in packages/bsky, with runtime wrapper in services/bsky.

Lexicons: for both the com.atproto.* and app.bsky.* are canonically versioned in this repo, for now, under ./lexicons/. These are JSON files in the Lexicon schema definition language, similar to JSON Schema or OpenAPI.

Interoperability Test Data: the language-neutral test files in ./interop-test-files/ may be useful for other protocol implementations to ensure that they follow the specification correctly

The source code for the Bluesky Social client app (for web and mobile) can be found at bluesky-social/social-app.

Go programming language source code is in bluesky-social/indigo, including the BGS implementation.

Developer Quickstart

We recommend nvm for managing Node.js installs. This project requires Node.js version 22 or later. pnpm is used to manage the workspace of multiple packages. You can install it with npm install --global pnpm.

There is a Makefile which can help with basic development tasks:

# use existing nvm to install node 22 and pnpm
make nvm-setup

# pull dependencies and build all local packages
make deps
make build

# run the tests, using Docker services as needed
make test

# run a local PDS and AppView with fake test accounts and data
# (this requires a global installation of `jq` and `docker`)
make run-dev-env

# show all other commands
make help

About AT Protocol

The Authenticated Transfer Protocol ("ATP" or "atproto") is a decentralized social media protocol, developed by Bluesky Social PBC. Learn more at:

The Bluesky Social application encompasses a set of schemas and APIs built in the overall AT Protocol framework. The namespace for these "Lexicons" is app.bsky.*.

Contributions

While we do accept contributions, we prioritize high quality issues and pull requests. Adhering to the below guidelines will ensure a more timely review.

Rules:

  • We may not respond to your issue or PR.
  • We may close an issue or PR without much feedback.
  • We may lock discussions or contributions if our attention is getting DDOSed.
  • We do not provide support for build issues.

Guidelines:

  • Check for existing issues before filing a new one, please.
  • Open an issue and give some time for discussion before submitting a PR.
  • If submitting a PR that includes a lexicon change, please get sign off on the lexicon change before doing the implementation.
  • Issues are for bugs & feature requests related to the TypeScript implementation of atproto and related services.
  • For high-level discussions, please use the Discussion Forum.
  • For client issues, please use the relevant social-app repo.
  • Stay away from PRs that:
  • Refactor large parts of the codebase
  • Add entirely new features without prior discussion
  • Change the tooling or frameworks used without prior discussion
  • Introduce new unnecessary dependencies

Remember, we serve a wide community of users. Our day-to-day involves us constantly asking "which top priority is our top priority." If you submit well-written PRs that solve problems concisely, that's an awesome contribution. Otherwise, as much as we'd love to accept your ideas and contributions, we really don't have the bandwidth.

Are you a developer interested in building on atproto?

Bluesky is an open social network built on the AT Protocol, a flexible technology that will never lock developers out of the ecosystems that they help build. With atproto, third-party can be as seamless as first-party through custom feeds, federated services, clients, and more.

Security disclosures

If you discover any security issues, please send an email to security@bsky.app. The email is automatically CCed to the entire team, and we'll respond promptly. See SECURITY.md for more info.

License

This project is dual-licensed under MIT and Apache 2.0 terms:

  • MIT license (LICENSE-MIT.txt or http://opensource.org/licenses/MIT)
  • Apache License, Version 2.0, (LICENSE-APACHE.txt or http://www.apache.org/licenses/LICENSE-2.0)

Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0.

Bluesky Social PBC has committed to a software patent non-aggression pledge. For details see the original announcement.

Extension points exported contracts — how you extend this code

Didable (Interface)
(no doc) [13 implementers]
packages/crypto/src/types.ts
ImageInvalidator (Interface)
(no doc) [6 implementers]
packages/bsky/src/image/invalidator.ts
ResourcePermission (Interface)
(no doc) [16 implementers]
packages/oauth/oauth-scopes/src/lib/resource-permission.ts
DidResolver (Interface)
(no doc) [13 implementers]
packages/internal/did-resolver/src/did-resolver.ts
ImageInvalidator (Interface)
(no doc) [8 implementers]
packages/aws/src/types.ts
ImageInvalidator (Interface)
(no doc) [6 implementers]
packages/ozone/src/image-invalidator.ts
LexiconIndexer (Interface)
(no doc) [39 implementers]
packages/lex/lex-document/src/lexicon-indexer.ts
DidCache (Interface)
(no doc) [5 implementers]
packages/identity/src/types.ts

Core symbols most depended-on inside this repo

map
called by 830
packages/oauth/oauth-scopes/src/scopes-set.ts
toString
called by 643
packages/lex/lex-data/src/cid.ts
from
called by 569
packages/lex/lex-data/src/lib/nodejs-buffer.ts
serviceHeaders
called by 566
packages/dev-env/src/network.ts
toISOString
called by 525
packages/syntax/src/datetime.ts
push
called by 481
packages/common-web/src/async.ts
assert
called by 473
packages/lex/lex-schema/src/core/schema.ts
getHeaders
called by 376
packages/tap/src/client.ts

Shape

Function 3,699
Method 3,233
Class 1,108
Interface 221
Enum 25

Languages

TypeScript100%

Modules by API surface

packages/bsky/src/views/index.ts90 symbols
packages/api/src/agent.ts81 symbols
packages/bsky/src/config.ts78 symbols
packages/oauth/oauth-provider-ui/src/lib/api.ts71 symbols
packages/lex/lex-builder/src/lex-def-builder.ts63 symbols
packages/repo/src/mst/mst.ts59 symbols
packages/pds/src/account-manager/account-manager.ts57 symbols
packages/bsky/src/hydration/hydrator.ts54 symbols
packages/pds/src/account-manager/oauth-store.ts50 symbols
packages/ozone/src/mod-service/subject.ts47 symbols
packages/lex/lex-schema/src/core/validation-issue.ts46 symbols
packages/xrpc-server/src/errors.ts45 symbols

Dependencies from manifests, versioned

@atproto-labs/did-resolverworkspace:^ · 1×
@atproto-labs/fetchworkspace:^ · 1×
@atproto-labs/fetch-nodeworkspace:^ · 1×
@atproto-labs/handle-resolverworkspace:^ · 1×
@atproto-labs/handle-resolver-nodeworkspace:^ · 1×
@atproto-labs/identity-resolverworkspace:^ · 1×
@atproto-labs/pipeworkspace:^ · 1×
@atproto-labs/rollup-plugin-bundle-manifestworkspace:^ · 1×
@atproto-labs/simple-storeworkspace:^ · 1×
@atproto-labs/simple-store-memoryworkspace:^ · 1×
@atproto-labs/simple-store-redisworkspace:^ · 1×
@atproto-labs/xrpc-utilsworkspace:^ · 1×

Datastores touched

postgresDatabase · 1 repos

For agents

$ claude mcp add atproto \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact