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

@codexsploitx/schemaapi

v1.1.13

Published

Type-safe API contracts (HTTP/WebSocket) with adapters, client and docs generator.

Downloads

1,409

Readme

⚡ SchemaApi

The Contract-First API Standard for TypeScript

npm version Downloads License TypeScript

Build type-safe APIs at the speed of thought.
Define your contract once. Generate Backend Controllers, Frontend SDKs, and Documentation instantly.


🔮 The Future of API Development

SchemaApi isn't just a validation library. It's an Architecture.

By defining a Single Source of Truth (Contract), you eliminate the disconnect between your Backend and Frontend.

🆚 The Old Way vs. The SchemaApi Way

| ❌ Traditional | ✅ SchemaApi | | :--- | :--- | | Write Controllers manually | Auto-generated strict controllers | | Write types.ts manually | Types inferred from schema | | Write Frontend Fetch calls | Auto-generated Typed SDK | | Update Swagger manually | Auto-generated Documentation | | "It works on my machine" | "It adheres to the contract" |


✨ Superpowers

| 🛡️ End-to-End Type Safety | ⚡ Runtime Validation | 🔌 Adapter Agnostic | | :--- | :--- | :--- | | Your Backend types ARE your Frontend types. Zero duplication. | Powered by Zod. If the data is wrong, the request never hits your logic. | Works with Express, Next.js, Fastify, NestJS, Remix, and more. |

| 📦 Zero-Config SDK | 🚀 Instant Mocking | 📚 Live Documentation | | :--- | :--- | :--- | | Frontend devs get a fully typed client. client.users.get({ id }) | Start frontend work before the backend is even written. | Beautiful HTML docs generated from your contracts. |


🚀 Quick Start

Go from Zero to Production-Ready API in 30 seconds.

1. Initialize

npx @codexsploitx/schemaapi init express

2. Generate Resource

npx @codexsploitx/schemaapi generate resource users

3. Generate SDK

npx @codexsploitx/schemaapi generate sdk users

That's it. You now have:

  • contracts/usersContract.ts: The definition.
  • src/routes/users.ts: The backend implementation.
  • src/sdk/usersClient.ts: The frontend client.

🧩 The Ecosystem (Adapters)

SchemaApi plays nice with everyone. Use the CLI to drop into any stack.

| Stack | Status | CLI Command | | :--- | :---: | :--- | | Express | 🟢 Stable | npx ... init express | | Next.js | 🟢 Stable | npx ... init next | | Fastify | 🟢 Stable | npx ... init fastify | | Remix | 🟢 Stable | npx ... init remix | | NestJS | 🟢 Stable | npx ... init nest | | Deno | 🟢 Stable | npx ... init deno | | Koa/Hapi| 🟡 Beta | npx ... init koa |


🛠️ Usage Example

1️⃣ The Contract (contracts/post.ts)

This is the Law.

import { createContract } from "@codexsploitx/schemaapi";
import { z } from "zod";

export const postContract = createContract({
  name: "posts",
  routes: {
    "GET /posts/:id": {
      params: z.object({ id: z.string().uuid() }),
      responses: {
        200: z.object({ id: z.string(), title: z.string() }),
        404: z.object({ error: z.string() })
      }
    }
  }
});

2️⃣ The Backend (src/routes/post.ts)

Implement the logic. Types are enforced.

// Express Adapter Example
router.get("/posts/:id", async (req, res) => {
  // `req.params.id` is strictly typed as string (UUID)
  const post = await db.find(req.params.id);
  
  if (!post) return res.status(404).json({ error: "Not found" });
  
  // Return type is checked against contract
  return res.json(post); 
});

3️⃣ The Frontend (src/app.ts)

Consume with the generated SDK.

import { PostClient } from "./sdk/postClient";

const client = new PostClient("https://api.myapp.com");

// ✨ Autocomplete heaven
const post = await client.getPost({ id: "123-abc" });
console.log(post.title);

💻 CLI Commands

Your swiss-army knife for API development.

  • npx @codexsploitx/schemaapi init <stack> -> Setup project
  • npx @codexsploitx/schemaapi generate resource <name> -> Create API route
  • npx @codexsploitx/schemaapi generate sdk <name> -> Create Typed Client
  • npx @codexsploitx/schemaapi generate tests <name> -> Create Integration Tests
  • npx @codexsploitx/schemaapi generate docs -> Build HTML Documentation website
  • npx @codexsploitx/schemaapi audit -> Check for security & best practices

Ready to build the future?

Get Started

MIT © CodexSploitx