Sourcemap Explorer
Stack · npm package

zod

TypeScript-first schema declaration and validation library with static type inference

latest 4.4.3· MIT· 875 versions publishedView on npm

About

TypeScript-first schema declaration and validation library with static type inference

typescriptschemavalidationtypeinference

What detecting zod tells you about a site

zod in a client bundle reveals a TypeScript-first team that validates data at runtime, not just at compile time — typically parsing API responses, form inputs or environment config against a schema. Its presence is a strong signal of a modern, type-safe codebase.

Why the exact zod version matters

zod 3 to 4 brought significant performance and API changes, and zod is a frequent transitive dependency of tRPC, react-hook-form resolvers and many form stacks. The exact version tells you which schema API the code targets and whether it lines up with the validation ecosystem around it.

zod in a real-world stack

When you find zod in a bundle, it rarely travels alone. react-hook-form (via @hookform/resolvers), @trpc/client, and drizzle-orm in full-stack TypeScript apps.

Quick facts

Latest version4.4.3
LicenseMIT
AuthorColin McDonnell
Homepagezod.dev
Installnpm install zod
Direct dependencies0

How Sourcemap Explorer detects zod

zod ships as v4.4.3, published 2026-05-04 and carries 0 direct dependencies, 875 versions on the registry. Those exact numbers are the footprint Sourcemap Explorer matches when zod rides inside a deployed bundle — here is how the detection works.

We catch zod from two complementary signals: bundled source paths and the embedded package.json. Modern bundlers (webpack, Vite, esbuild, Rollup, Turbopack) preserve the original node_modules/zod/ paths inside the JavaScript sourcemap's sources[] array — that's the canonical signal. When the matching package.json is also captured in sourcesContent[], we read the exact version field — patch number included. No regex guessing, no version inference.

  1. 1

    Confirm the site exposes sourcemaps

    In DevTools Network, check the response headers of any application script for `SourceMap` or `X-SourceMap`. Failing that, fetch the script's last 4 KB and look for a `//# sourceMappingURL=` comment — that map is where the `zod` paths live.

  2. 2

    Find the package in the bundle

    Open DevTools → Network → reload. Click any application script and look at its sourcemap. Inside, search `sources[]` for entries matching `node_modules/zod/` — every match confirms the package is bundled. The matching `sourcesContent[i]` for `node_modules/zod/package.json` gives you the exact installed version.

  3. 3

    Read the version directly from package.json

    Run `jq -r '. as $m | $m.sources | to_entries[] | select(.value | endswith("node_modules/zod/package.json")) | $m.sourcesContent[.key] | fromjson | .version' bundle.js.map`. Sourcemap Explorer automates the same query in the popup.

Major releases of zod

When each major version first landed. Major bumps are where breaking changes live, so this timeline is the fastest way to date the zod version a site actually ships against the ecosystem.

Major
First release
Date
v4
4.0.0
2025-07-09
v3
3.0.0
2021-05-17
v1
1.0.0
2020-03-07

Recent security advisories for zod

The 1 most recent advisories affecting some versions of zod, aggregated from OSV.dev (GitHub Advisory + CVE data). A listing here doesn't mean the version a given site ships is affected — each advisory applies to a specific version range. Sourcemap Explorer reads the exact bundled version so you can check it against these ranges.

  1. MODERATECVE-2023-4316· 2023-09-28

    Zod denial of service vulnerability

Recent versions

Version
Released
4.4.3
2026-05-04
4.4.2
2026-05-01
4.4.1
2026-04-29
4.4.0
2026-04-29
4.3.6
2026-01-22
4.3.5
2026-01-04
4.3.4
2025-12-31
4.3.3
2025-12-31

zod README

Live mirror of the GitHub README, for reference. Updated whenever the repo's default branch changes.

Zod logo

Zod

TypeScript-first schema validation with static type inference
by @colinhacks


Zod CI status License npm discord server stars

Docs   •   Discord   •   𝕏   •   Bluesky


Read the docs →



What is Zod?

Zod is a TypeScript-first validation library. Define a schema and parse some data with it. You'll get back a strongly typed, validated result.

import * as z from "zod";

const User = z.object({
  name: z.string(),
});

// some untrusted data...
const input = {
  /* stuff */
};

// the parsed result is validated and type safe!
const data = User.parse(input);

// so you can use it with confidence :)
console.log(data.name);

Features

  • Zero external dependencies
  • Works in Node.js and all modern browsers
  • Tiny: 2kb core bundle (gzipped)
  • Immutable API: methods return a new instance
  • Concise interface
  • Works with TypeScript and plain JS
  • Built-in JSON Schema conversion
  • Extensive ecosystem

Installation

npm install zod

Basic usage

Before you can do anything else, you need to define a schema. For the purposes of this guide, we'll use a simple object schema.

import * as z from "zod";

const Player = z.object({
  username: z.string(),
  xp: z.number(),
});

Parsing data

Given any Zod schema, use .parse to validate an input. If it's valid, Zod returns a strongly-typed deep clone of the input.

Player.parse({ username: "billie", xp: 100 });
// => returns { username: "billie", xp: 100 }

Note — If your schema uses certain asynchronous APIs like async refinements or transforms, you'll need to use the .parseAsync() method instead.

const schema = z.string().refine(async (val) => val.length <= 8);

await schema.parseAsync("hello");
// => "hello"

Handling errors

When validation fails, the .parse() method will throw a ZodError instance with granular information about the validation issues.

try {
  Player.parse({ username: 42, xp: "100" });
} catch (err) {
  if (err instanceof z.ZodError) {
    err.issues;
    /* [
      {
        expected: 'string',
        code: 'invalid_type',
        path: [ 'username' ],
        message: 'Invalid input: expected string'
      },
      {
        expected: 'number',
        code: 'invalid_type',
        path: [ 'xp' ],
        message: 'Invalid input: expected number'
      }
    ] */
  }
}

To avoid a try/catch block, you can use the .safeParse() method to get back a plain result object containing either the successfully parsed data or a ZodError. The result type is a discriminated union, so you can handle both cases conveniently.

const result = Player.safeParse({ username: 42, xp: "100" });
if (!result.success) {
  result.error; // ZodError instance
} else {
  result.data; // { username: string; xp: number }
}

Note — If your schema uses certain asynchronous APIs like async refinements or transforms, you'll need to use the .safeParseAsync() method instead.

const schema = z.string().refine(async (val) => val.length <= 8);

await schema.safeParseAsync("hello");
// => { success: true; data: "hello" }

Inferring types

Zod infers a static type from your schema definitions. You can extract this type with the z.infer<> utility and use it however you like.

const Player = z.object({
  username: z.string(),
  xp: z.number(),
});

// extract the inferred type
type Player = z.infer<typeof Player>;

// use it in your code
const player: Player = { username: "billie", xp: 100 };

In some cases, the input & output types of a schema can diverge. For instance, the .transform() API can convert the input from one type to another. In these cases, you can extract the input and output types independently:

const mySchema = z.string().transform((val) => val.length);

type MySchemaIn = z.input<typeof mySchema>;
// => string

type MySchemaOut = z.output<typeof mySchema>; // equivalent to z.infer<typeof mySchema>
// number

FAQ

What is zod used for?

TypeScript-first schema declaration and validation library with static type inference

How can I tell if a website is using zod?

Open the page in Chrome with the Sourcemap Explorer extension installed and read the Stack tab. We catch `zod` from two complementary signals: `node_modules/zod/` paths inside the JavaScript sourcemap, and the embedded `package.json` we read for exact-version detection. Without the extension you can do the same lookup manually in DevTools — the steps are listed in the "How Sourcemap Explorer detects" section above.

How do I find out which version of zod a website is running?

Read it straight from the site's JavaScript sourcemap. When a build ships source maps, the bundled `zod/package.json` carries the exact `version` string — Sourcemap Explorer extracts it in one click on the Stack tab, and you can do it by hand in DevTools by opening the `.map` file and searching for `node_modules/zod/package.json`. That is far more reliable than inferring the version from an asset-hash or a `?ver=` query string, which is all surface-level detectors have to go on. The current npm release is 4.4.3, but real deployments frequently run an older pinned version — which is exactly why reading the bundled number matters.

What is the latest version of zod?

4.4.3, as published on the npm registry. The "Recent versions" table on this page lists the most recent 8 releases with their release dates. Sourcemap Explorer reports the version actually bundled into a site, which can lag the latest release by months on real-world deployments.

Is zod actively maintained?

Actively maintained — the package is shipping new releases at a steady cadence. The last published release was 2026-05-04. Source code: https://github.com/colinhacks/zod.

Does zod have known security vulnerabilities?

1 recent advisory affecting some versions of zod is listed in the "Recent security advisories" section above, aggregated from OSV.dev (GitHub Advisory + CVE data). Whether a particular site is exposed depends entirely on the exact version it ships — each advisory applies to a specific version range, not to the package as a whole. That is why the precise bundled version matters: Sourcemap Explorer reads the version a site actually runs, so you can check it against the affected ranges instead of assuming the latest release is what's deployed.

Where can I read more?

Project homepage: https://zod.dev. Source code: https://github.com/colinhacks/zod. Published on npm: https://www.npmjs.com/package/zod. Licensed as MIT.

Keep reading on Sourcemap Explorer

Detection deep dives

Detected by Sourcemap Explorer

When a bundle ships sourcemaps, we read the embedded package.json for zod and report the precise version (the registry's latest is v4.4.3, published 2026-05-04; the bundled copy is often older). Without sourcemaps, an import / require in the page's scripts is enough to flag it.

Install free on Chrome