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

@codama/spec

v1.6.0-rc.6

Published

The canonical Codama node specification and meta-model

Readme

Codama Spec

The canonical Codama node specification.

Overview

Codama is a standard for describing on-chain Solana programs as a graph of typed nodes (accounts, instructions, types, …). This repository contains:

  • The spec. A machine-readable description of every node in the Codama node graph, authored in TypeScript under src/ and emitted as v1/spec.json. Future Codama majors will land alongside as v2/spec.json, v3/spec.json, …
  • The meta-model API. Authoring helpers (defineNode, attribute, primitives, compounds, …) exposed at @codama/spec/api for hand-authoring specs and test fixtures.
  • Internal codegen. Generators under generators/ produce the public artifacts that mirror each spec major (v<n>/spec.json, v<n>/schema.json, v<n>/docs/). They are not exported from the @codama/spec package; they exist as internal tooling for this repo.

Reference implementations (TypeScript node types, node factories, visitors, validators, renderers, the CLI) live in codama-idl/codama and consume the published @codama/spec package. The Rust reference implementation lives in codama-idl/codama-rs.

Install

pnpm add @codama/spec
# or: npm install @codama/spec

Quickstart

@codama/spec exposes three entrypoints:

  • @codama/spec — the latest stable major's public surface. Re-exports @codama/spec/v1 today; will track future majors.
  • @codama/spec/v1 — the v1 spec data, accessors (getSpec, getNode, getUnion, getEnumeration), and the version-agnostic types (NodeSpec, UnionSpec, …).
  • @codama/spec/api — the meta-model authoring API (defineNode, attribute, primitives, compounds, …) for hand-authoring specs and test fixtures.

Read the spec

import { getSpec, getNode, SPEC_VERSION } from '@codama/spec/v1';

const spec = getSpec();
console.log(spec.version); // → '1.6.0'
console.log(SPEC_VERSION); // → '1.6.0'

const account = getNode('accountNode');
console.log(account?.attributes.map(a => a.name));
// → ['name', 'size', 'docs', 'data', 'pda', 'discriminators']

Hand-author a node

import { attribute, defineNode, string, u32 } from '@codama/spec/api';

const myNode = defineNode('myNode', {
    docs: ['A custom node, hand-authored.'],
    attributes: [attribute('name', string()), attribute('size', u32(), { docs: ['Size in bytes.'] })],
});

Repository layout

src/                       # package source (the @codama/spec public surface)
tests/                     # package tests
generators/                # internal codegen orchestrator + per-target generators
  index.ts                 # runs every registered generator sequentially
  json-spec/               # emits v<n>/spec.json
  json-schema/             # emits v<n>/schema.json (stub)
  docs/                    # emits v<n>/docs/ (stub)
v1/                        # generated artifacts mirroring the @codama/spec/v1 surface
  spec.json
  schema.json
  docs/
.changeset/                # release intent files (managed by @changesets/cli)

Releasing

@codama/spec is released through changesets:

  1. Run pnpm changeset on your branch to record a bump and a user-facing summary.
  2. Commit the generated .changeset/*.md alongside your changes.
  3. On merge to main, the Main workflow either opens a "Release package" PR (when changesets are pending) or publishes @codama/spec to npm (when versions have been bumped).

The repo is currently in release-candidate mode under the rc tag (see .changeset/pre.json). Every pnpm changeset version produces a 1.6.0-rc.N version. To cut the stable release, run pnpm changeset pre exit, then pnpm changeset version and merge the resulting "Release package" PR.

License

MIT — same as the rest of the Codama ecosystem.