a collection of lightweight TypeScript packages for AT Protocol, the protocol powering Bluesky
atproto
bluesky
typescript
npm
1# atcute
2
3a collection of lightweight TypeScript packages for AT Protocol, the protocol powering Bluesky,
4featuring:
5
6- an [API client][client] for making typed HTTP requests, with support for lexicons like
7 [WhiteWind][whitewind] or [Bluemoji][bluemoji]
8- an [OAuth client for SPA applications][oauth-browser-client] for authentication use-cases
9- a grab bag of utility packages:
10 - codec libraries for [DASL][dasl] data formats, a strict subset of IPLD specifications, like
11 CIDv1, DAG-CBOR and CAR, but tailored specifically for atproto
12 - codec for atproto's timestamp identifiers
13 - cryptography library for signing and verification of signatures in atproto
14 - schema validators for DID documents, and verification of did:plc operations
15 - Bluesky-specific helpers like [a rich text builder][bluesky-richtext-builder] and [a post thread
16 builder][bluesky-threading]
17
18looking for more? check out [skyware][skyware], an additional collection of packages, built on top
19of atcute.
20
21[bluemoji]: ./packages/definitions/bluemoji
22[bluesky-richtext-builder]: ./packages/bluesky/richtext-builder
23[bluesky-threading]: ./packages/bluesky/threading
24[client]: ./packages/core/client
25[oauth-browser-client]: ./packages/oauth/browser-client
26[whitewind]: ./packages/definitions/whitewind
27[dasl]: https://dasl.ing/
28[ipld]: https://ipld.io/
29[skyware]: https://skyware.js.org/
30
31---
32
33| Packages |
34| ---------------------------------------------------------------------------------------------------------------------- |
35| **Client packages** |
36| [`client`](./packages/clients/client): API client library |
37| [`jetstream`](./packages/clients/jetstream): Jetstream client |
38| **Server packages** |
39| [`xrpc-server`](./packages/servers/xrpc-server): web framework |
40| **OAuth packages** |
41| [`oauth-browser-client`](./packages/oauth/browser-client): minimal OAuth browser client implementation |
42| **Lexicon packages** |
43| [`lex-cli`](./packages/lexicons/lex-cli): CLI tool to generate schema definitions |
44| [`lexicon-doc`](./packages/lexicons/lexicon-doc): type definitions and schemas for lexicon documents |
45| [`lexicons`](./packages/lexicons/lexicons): core lexicon types, interfaces, and schema validations |
46| **Lexicon definition packages** |
47| [`atproto`](./packages/definitions/atproto): `com.atproto.*` schema definitions |
48| [`bluemoji`](./packages/definitions/bluemoji): `blue.moji.*` schema definitions |
49| [`bluesky`](./packages/definitions/bluesky): `app.bsky.*` and `chat.bsky.*` schema definitions |
50| [`frontpage`](./packages/definitions/frontpage): `fyi.unravel.frontpage.*` schema definitions |
51| [`lexicon-community`](./packages/definitions/lexicon-community): `community.lexicon.*` schema definitions |
52| [`ozone`](./packages/definitions/ozone): `tools.ozone.*` schema definitions |
53| [`tangled`](./packages/definitions/tangled): `sh.tangled.*` schema definitions |
54| [`whitewind`](./packages/definitions/whitewind): `com.whtwnd.*` schema definitions |
55| **Identity packages** |
56| [`did-plc`](./packages/identity/did-plc): validations, type definitions and schemas for did:plc operations |
57| [`identity`](./packages/identity/identity): syntax, type definitions and schemas for handles, DIDs and DID documents |
58| [`identity-resolver`](./packages/identity/identity-resolver): handle and DID document resolution |
59| [`identity-resolver-node`](./packages/identity/identity-resolver-node): additional identity resolvers for Node.js |
60| **Utility packages** |
61| [`car`](./packages/utilities/car): DASL CAR and atproto repository decoder |
62| [`cbor`](./packages/utilities/cbor): DASL dCBOR42 codec |
63| [`cid`](./packages/utilities/cid): DASL CID codec |
64| [`crypto`](./packages/utilities/crypto): cryptographic utilities |
65| [`multibase`](./packages/utilities/multibase): multibase utilities |
66| [`tid`](./packages/utilities/tid): atproto timestamp identifier codec |
67| [`varint`](./packages/utilities/varint): protobuf-style LEB128 varint codec |
68| **Bluesky-specific packages** |
69| [`bluesky-moderation`](./packages/bluesky/moderation): interprets Bluesky's content moderation labels |
70| [`bluesky-richtext-builder`](./packages/bluesky/richtext-builder): builder pattern for Bluesky's rich text facets |
71| [`bluesky-richtext-parser`](./packages/bluesky/richtext-parser): parse Bluesky's (extended) rich text syntax |
72| [`bluesky-richtext-segmenter`](./packages/bluesky/richtext-segmenter): segments Bluesky's rich text facets into tokens |
73| [`bluesky-threading`](./packages/bluesky/threading): create Bluesky threads containing multiple posts with one write |
74
75## contribution guide
76
77this monorepo uses [`mise`](https://mise.jdx.dev) to handle versioning, although it doesn't really
78matter. Node.js LTS is necessary to use the `internal-dev-env` package for testing the `client`
79package with the official PDS distribution, but otherwise you can (and should) use the latest
80available version.
81
82```sh
83# Install all the recommended runtimes
84mise install
85
86# Runs all the build scripts
87pnpm run -r build
88
89# Pull in the latest ATProto/Ozone/Bluesky lexicons, and generate the type declarations
90pnpm run pull
91pnpm run -r generate
92```
93
94### checking package sizes
95
96to observe the size of packages (both install size and bundled size), there is a `pkg-size-report`
97tool doing just that. you can also save the package sizes at a given time and inspect the impact of
98changes to the final bundle size. the tool uses `esbuild` to produce a minified bundle to get the
99size of each entrypoint.
100
101<!-- prettier-ignore-start -->
102<!-- Otherwise it wrecks the gfm alertbox ugh -->
103
104> [!WARNING]
105> run `pnpm run -r build` before running the command. otherwise, the command **may not run**, or **give bad measurements**.
106
107<!-- prettier-ignore-end -->
108
109```sh
110# See the size of packages.
111# If package sizes were saved previously, will also show the diff.
112pnpm pkg-size-report
113
114# Save esbuild metafiles and package size information.
115pnpm pkg-size-report --save
116
117# Save just esbuild metafiles.
118pnpm pkg-size-report --save-meta
119
120# Show only the packages whose size have changed.
121pnpm pkg-size-report --compare
122
123# Keep the result bundle produced by esbuild.
124# Will be left in /tmp/[...]--[pkgname]--[random]
125pnpm pkg-size-report --keep-builds
126```