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

@sapporta/rest-core

v3.52.2

Published

Sapporta-maintained ts-rest core fork for Zod 4 contracts and inference

Downloads

403

Readme

sapporta-rest

sapporta-rest is a Sapporta-maintained fork of the v4 branch of ts-rest.

The upstream ts-rest project remains the canonical general-purpose project and documentation source. Use the upstream documentation at https://ts-rest.com for the broad contract DSL model, then account for the narrower Sapporta package surface described here.

Packages

This repository publishes two public npm packages:

  • @sapporta/rest-core
  • @sapporta/rest-open-api

The package versions track the upstream ts-rest v4 versioning line.

Scope

This fork keeps the contract DSL, inference helpers, runtime helpers, client helpers, route traversal, and OpenAPI generation used by Sapporta. It intentionally removes framework adapters and OpenAPI validator branches Sapporta does not use.

Supported:

  • Zod 4 schemas
  • Standard Schema-compatible core contracts, including Valibot and no-validator contracts
  • initContract
  • initClient
  • the lightweight fetch-based browser/client API from core, returning { status, body }
  • core route and response inference types
  • generateOpenApi
  • generateOpenApiAsync
  • caller-provided Zod 4 schema transformers, including transformers based on z.toJSONSchema

Not supported:

  • Zod 3
  • @anatine/zod-openapi
  • non-Zod OpenAPI schema transformation
  • Express, Fastify, Nest, Next, Serverless, React Query, Solid Query, or Vue Query adapters
  • Prisma integration
  • upstream docs app and examples
  • upstream multi-validator test projects

Browser Client

Sapporta UI code can import initClient from @sapporta/rest-core and call browser fetch through the same contracts used by the server:

import { initClient } from '@sapporta/rest-core';

const client = initClient(contract, {
  baseUrl: 'http://localhost:3000',
});

const result = await client.getPokemon({
  params: { id: '1' },
});

The removed client packages are framework/query-cache adapters such as React Query, Vue Query, and Solid Query. They are separate from the core fetch client and are not required for Sapporta's browser contract calls.

OpenAPI

@sapporta/rest-open-api does not ship a default Anatine transformer. Callers must pass a schema transformer:

import { generateOpenApi } from '@sapporta/rest-open-api';
import { z } from 'zod';

const zodV4SchemaTransformer = ({ schema }) => {
  if (!schema || typeof schema !== 'object' || !('_zod' in schema)) {
    return null;
  }

  const { $schema, ...jsonSchema } = z.toJSONSchema(schema);
  return jsonSchema;
};

const document = generateOpenApi(router, apiDoc, {
  schemaTransformer: zodV4SchemaTransformer,
});

License And Upstream Credit

This fork preserves the upstream MIT license. The original project is ts-rest, and its documentation is available at https://ts-rest.com.