Schelo

Ship fast. Catch broken API types before your users do.

Zod schemas wired to fetch—validate real request and response payloads in the console, with field-level errors when something does not match.

Install

Add the package, then Zod if it is not already in your project (peer dependency). Next.js, run the CLI after install to scaffold InterceptorProvider and related files follow the printed steps in your repo.

Install command

npm install schelo zod

CLI for Next.js and React — run from your project root:

npx schelo init

How it works

You describe which URLs matter and what JSON should look like; the interceptor does the rest at runtime.

  • Register routes

    List endpoints in routes with optional request and response Zod schemas.

  • Traffic is watched

    Your app uses fetch; matching calls are checked automatically.

  • Match & validate

    When the URL matches a pattern like GET /api/users/:id, JSON is validated against your schema.

  • Clear feedback

    Failures: boxed console output with route and fields. Success: nothing printed.

Create the config

createInterceptor + a routes map (METHOD /path keys, optional Zod request / response). Failures go to the console only—no log buffer. Details: Config & API. Enable via Next.js or React.

import { createInterceptor } from "schelo";
import { z } from "zod";

export const interceptor = createInterceptor({
  mode: "warn",
  routes: {
    "GET /api/health": {
      response: z.object({ status: z.literal("ok") }),
    },
    "POST /api/items": {
      request: z.object({ title: z.string() }),
      response: z.object({ id: z.string(), title: z.string() }),
    },
  },
});

Documentation

Setup guides, config options, and API reference in plain language.