{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreibnt7i36iepisbd2ho6nxxj42rfl3s7zb2ulrdfczcix4cbjw5gpm",
"uri": "at://did:plc:cwdkf4xxjpznceembuuspt3d/app.bsky.feed.post/3lfjooenx2c2s"
},
"canonicalUrl": "https://jack.is/posts/atcute-comments/",
"description": "using @atcute/client to make comments better",
"path": "/posts/atcute-comments/",
"publishedAt": "2025-01-12T06:31:38.000Z",
"site": "at://did:plc:cwdkf4xxjpznceembuuspt3d/site.standard.publication/3mdrpafzz7c2m",
"tags": [
"atproto",
"blog"
],
"textContent": "Having comments on my blog with Bluesky is pretty nice, but what's not so nice\nis having to bring in the entire @atproto/api package. It seemingly can't be\ntree shaken down via Vite, so you end up with a massive JS file for comments.\n\nHow massive is it? More than 700kB.\n\n!screenshot of terminal, with the size of the bluesky comments file highlighted showing 700kB\n\nIt's kinda a lot, and as it is I had to tweak my Astro config to make Vite not\nwarn about this:\n\nI wasn't a huge fan of this for a few reasons. One, that was a lot of unneeded\nJS being delivered that I didn't need, and I had to modify a warning setting\nwhich seemed less than ideal.\n\nI had seen @atcute/client by Mary float across my\nfeed, and poked at it a bit, but only after I figured out how to make unauthenticated\nrequests with it did it become clear how much better it was going to make my\nbundles.\n\nOnly took a little bit of modifying the work I had done using Emily Liu's example\nto instead use atcute:\n\nThe unexpected benefit here is that @atproto/api didn't actually have all the\nhelper functions Emily needed for it to work, so there was a direct call to one\nof the xrpc endpoints. Now that everything just uses rpc.get, it's a lot more\nconsistent and easier to follow.\n\nI did have to add a few //@ts-expect-error sprinkled around, but they're all\nguarded by typeguards so I'm not too worried.\n\nNow instead of 700kB, my BlueskyComments.js is only 10kB. A vast improvement.\n\nThanks again to Emily for posting their code to begin with, and Mary for an\nexcellent suite of tooling that's much more compact than the full ATProto API.",
"title": "Optimizing Bluesky comments",
"updatedAt": "2025-01-13T06:41:51.000Z"
}