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

@livon/schema

v0.29.0-rc.11

Published

Schema builders, validators, and API definitions for LIVON.

Readme

@livon/schema

npm dependencies npm publish OpenSSF Best Practices Snyk security package size license

Install

pnpm add @livon/schema

Purpose

@livon/schema defines:

Best for

Use this package when you want a single schema source for validation, typing, and generated client APIs.

Schema API docs

Each schema/combinator has its own usage page:

Type safety model

LIVON schemas are both runtime validators and type sources. Primitive schema names are optional, so string() and number() are valid defaults.

  1. Define payload shape once in schema.
  2. Validate unknown input with parse().
  3. Reuse schema entrypoint with typed().
  4. Derive types with Infer instead of hand-written payload interfaces.
import {object, string, number, type Infer} from '@livon/schema';

const User = object({
  name: 'User',
  shape: {
    id: string(),
    age: number().int().min(0),
  },
});

type UserType = Infer<typeof User>;

const input: unknown = JSON.parse(raw);
const parsed = User.parse(input);
const typedInput: UserType = {id: 'u-1', age: 21};
const typed = User.typed(typedInput);

Parameters in this example

object({...}):

  • name (string): schema node name.
  • shape (Record<string, Schema>): field schema map.

number().int().min(0):

  • min (number): minimum allowed numeric value.

User.parse(input):

  • input (unknown): runtime value to validate/parse.

User.typed(typedInput):

  • typedInput (UserType): pretyped value using same schema entrypoint.

Compose API schema

import {api} from '@livon/schema';

const ApiSchema = api({
  type: User,
  operations: {
    sendMessage,
  },
  subscriptions: {
    onMessage,
  },
  fieldOperations: {
    greeting: userGreetingResolver,
  },
});

export const serverSchema = ApiSchema;

Use the api(...) (or composeApi(...)) result directly in schemaModule(...). No additional schema-module input factory is required.

Parameters in this example

api({...}):

  • type (Schema, optional): entity schema for field operations.
  • operations (Record<string, Operation>, optional): request/response operations.
  • subscriptions (Record<string, Subscription | Schema>, optional): publish topic schemas.
  • fieldOperations (Record<string, FieldOperation>, optional): field-level resolvers.

For focused usage patterns:

Mount schema module into runtime

import {runtime} from '@livon/runtime';
import {schemaModule} from '@livon/schema';

runtime(schemaModule(serverSchema, {explain: true}));

Parameters in this example

schemaModule(serverSchema, options?):

  • serverSchema (Api | ComposedApi): fully composed schema from api(...) or composeApi(...).
  • options.explain (boolean, optional): enables $explain endpoint for AST/checksum metadata.

Explain endpoint

If explain: true, schema module responds to $explain with AST/checksum metadata.

Related pages