npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@vinerima/jetstream-types

v2.0.0

Published

Zod schemas and TypeScript types for Bluesky Jetstream events, generated from AT Protocol lexicon definitions.

Readme

@vinerima/jetstream-types

Zod schemas and TypeScript types for Bluesky Jetstream events, generated from official AT Protocol lexicon definitions.

Installation

npm install @vinerima/jetstream-types

Requires zod v4 as a peer dependency.

Usage

Validate a Jetstream post create event

import { jetstreamPostCreateSchema, jetstreamToPost } from "@vinerima/jetstream-types";

const parsed = jetstreamPostCreateSchema.parse(rawMessage);
const post = jetstreamToPost(parsed);

Validate any collection's commit events

import {
  jetstreamCommitCreateSchema,
  jetstreamCommitDeleteSchema,
} from "@vinerima/jetstream-types";

// Typed by collection — record field is fully typed
const likeCreate = jetstreamCommitCreateSchema("app.bsky.feed.like").parse(raw);
// likeCreate.commit.record is { $type: "app.bsky.feed.like", subject: {...}, createdAt: string }

const followCreate = jetstreamCommitCreateSchema("app.bsky.graph.follow").parse(raw);
// followCreate.commit.record is { $type: "app.bsky.graph.follow", subject: string, createdAt: string }

// Delete events have no record field
const deleted = jetstreamCommitDeleteSchema.parse(raw);

Validate identity and account events

import { jetstreamIdentitySchema, jetstreamAccountSchema } from "@vinerima/jetstream-types";

const identity = jetstreamIdentitySchema.parse(raw);
const account = jetstreamAccountSchema.parse(raw);

Use record schemas standalone

import { appBskyFeedPost, appBskyActorProfile } from "@vinerima/jetstream-types";

const post = appBskyFeedPost.parse(record);
const profile = appBskyActorProfile.parse(record);

Supported collections

| Collection | Schema | |---|---| | app.bsky.feed.post | appBskyFeedPost | | app.bsky.feed.like | appBskyFeedLike | | app.bsky.feed.repost | appBskyFeedRepost | | app.bsky.feed.threadgate | appBskyFeedThreadgate | | app.bsky.feed.postgate | appBskyFeedPostgate | | app.bsky.graph.follow | appBskyGraphFollow | | app.bsky.graph.block | appBskyGraphBlock | | app.bsky.graph.list | appBskyGraphList | | app.bsky.graph.listitem | appBskyGraphListitem | | app.bsky.graph.listblock | appBskyGraphListblock | | app.bsky.actor.profile | appBskyActorProfile |

All record schemas include their transitive dependencies (embeds, facets, labels, strongRef, etc.).

Exports

Envelope schemas

  • jetstreamCommitCreateSchema(collection) -- typed commit create envelope for a given collection
  • jetstreamCommitUpdateSchema(collection) -- typed commit update envelope
  • jetstreamCommitDeleteSchema -- commit delete envelope (no record field)
  • jetstreamIdentitySchema -- identity event envelope
  • jetstreamAccountSchema -- account event envelope

Record schemas

All AT Protocol record types listed above, plus supporting types like comAtprotoRepoStrongRef, appBskyRichtextFacet, comAtprotoLabelDefsSelfLabels, embed schemas, etc.

Each schema has a corresponding TypeScript type export (PascalCase), e.g. AppBskyFeedPost, AppBskyFeedLike.

Utilities

  • collectionSchemas -- mapping from collection NSID string to its Zod record schema
  • CollectionNsid -- union type of all supported collection NSID strings
  • jetstreamToPost(msg) -- converts a post create event into a flat Post object
  • Post -- interface with uri, cid, authorDid, text, rootUri, rootCid

Backward-compatible (v1)

  • jetstreamPostCreateSchema -- equivalent to jetstreamCommitCreateSchema("app.bsky.feed.post")
  • JetstreamPostCreate -- inferred type

Regenerating schemas

Record schemas are generated from official AT Protocol lexicon JSON files. To regenerate after upstream changes:

pnpm codegen
pnpm build

The codegen script fetches lexicons from the bluesky-social/atproto repository and outputs src/generated/lexicons.ts.

Breaking changes from v1

  • The embed field on app.bsky.feed.post is now a discriminated union of 5 specific embed types instead of z.unknown(). Records with non-standard embed shapes will fail validation.
  • The reply field now uses the generated comAtprotoRepoStrongRef schema (structurally identical to the previous hand-written schema).

License

MIT