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

@nostrwatch/schemata

v0.1.0

Published

JSON Schema definitions for Nostr protocol data structures.

Readme

@nostrwatch/schemata

JSON Schema definitions for Nostr protocol data structures.

npm version License Status

Overview

@nostrwatch/schemata provides JSON Schema definitions for Nostr protocol data structures including events (the signed JSON objects that form the basis of Nostr communication), NIP-11 relay info documents, and protocol messages. A schema (a JSON Schema document) describes the shape and constraints of a data structure so it can be validated programmatically.

Migration notice: This package is migrating to @nostrability/schemata under a separate npm organization. New projects should use @nostrability/schemata directly. @nostrwatch/schemata-js-ajv already depends on @nostrability/schemata rather than this package.

The schemas are defined in YAML format under nips/nip-XX/ and compiled to JSON at build time. Schemas exist for NIPs 01, 02, 11, 18, 22, 40, and 65.

Installation

pnpm add @nostrwatch/schemata

Or with npm:

npm install @nostrwatch/schemata

For new projects, prefer the successor package:

pnpm add @nostrability/schemata

Quick Start

The compiled schemas are available as JSON after running the build. Use them with any JSON Schema validator:

import Ajv from 'ajv'
import schema from '@nostrwatch/schemata/dist/schema.json'

const ajv = new Ajv()
const validate = ajv.compile(schema)

const event = {
  kind: 1,
  content: 'Hello from Nostr',
  created_at: Math.floor(Date.now() / 1000),
  tags: [],
  pubkey: '<32-byte-hex-pubkey>',
  id: '<32-byte-hex-id>',
  sig: '<64-byte-hex-sig>'
}

const valid = validate(event)
console.log(valid) // true or false

For a ready-to-use validation wrapper with AJV, see @nostrwatch/schemata-js-ajv.

API

The compiled output at dist/schema.json and dist/schema.content.json are the primary artifacts. The schema source is organized by NIP:

| NIP | Schema file | Covers | |-----|-------------|--------| | NIP-01 | nips/nip-01/ | Base event structure, kinds 0 and 1, protocol messages, unsigned notes | | NIP-11 | nips/nip-11/ | Relay information document (RelayInformationDocument) | | NIP-02 | nips/nip-02/ | Contact list events | | NIP-22 | nips/nip-22/ | Comment events | | NIP-40 | nips/nip-40/ | Expiration events | | NIP-65 | nips/nip-65/ | Relay list metadata | | NIP-18 | nips/nip-18/ | Reposts |

The build script compiles YAML sources to dist/schema.json (event schemas) and dist/schema.content.json (content schemas). The quicktype tool generates typed outputs for Rust, Python, Swift, Kotlin, Java, Go, TypeScript, and JavaScript from these JSON schemas.

Known Limitations

  • In-progress migration: This package is moving to @nostrability/schemata. The migration is underway; @nostrwatch/schemata-js-ajv already uses the new package. This package will remain available until all consumers migrate.
  • Build process required: Schemas are not available in raw form from the npm package — the YAML sources must be compiled via pnpm build. The dist files are included in the published package.

Agent Skills

No agent skills defined yet for this package.

Related Packages

License

MIT