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

@lucaconlaq/zod-to-code

v0.1.3

Published

Generate JavaScript/TypeScript code from Zod schemas.

Readme

Zod To Code

Logo

Generate JavaScript/TypeScript code from Zod schemas — round-trip safe 🌀

npm biome vitest


✨ What does it do?

  • ✍️ The library does one thing and tries to do it well. It enables code generation from zod schemas.
  • 🧪 It is fully tested.
  • 🧱 It supports most Zod types (see Supported Types).

🚀 Installation

npm i @lucaconlaq/zod-to-code

📦 Usage

import { z } from "zod";
import { zodToCode } from "@lucaconlaq/zod-to-code";

const schema = z.object({
  username: z.string(),
});

const code = zodToCode(schema);
console.log(code);

Outputs:

z.object({
  username: z.string()
})

🧩 Supported Types

| Type | Status | |----------------------------------|-------------------| | string | ✅ Supported | | number | ✅ Supported | | boolean | ✅ Supported | | date | ✅ Supported | | bigint | ✅ Supported | | symbol | ✅ Supported | | void | ✅ Supported | | never | ✅ Supported | | unknown | ✅ Supported | | any | ✅ Supported | | object | ✅ Supported | | array | ✅ Supported | | tuple | ✅ Supported | | record | ✅ Supported | | map | ✅ Supported | | set | ✅ Supported | | function | ✅ Supported | | lazy | ✅ Supported | | literal | ✅ Supported | | enum | ✅ Supported | | nativeEnum | ✅ Supported | | union | ✅ Supported | | intersection | ✅ Supported | | or | ✅ Supported | | and | ✅ Supported | | .optional() | ✅ Supported | | .nullable() | ✅ Supported | | .nullish() | ✅ Supported | | .default() | ✅ Supported | | .catch() | ✅ Supported | | .describe() | ✅ Supported | | .readonly() | ✅ Supported | | .brand() | ✅ Supported | | .int() | ✅ Supported | | .email() | ✅ Supported | | .uuid() | ✅ Supported | | .regex() | ✅ Supported | | .url() | ✅ Supported | | .ip() | ✅ Supported | | .datetime() | ✅ Supported | | .emoji() | ✅ Supported | | .refine() | ❌ Not Supported | | .superRefine() | ❌ Not Supported | | .transform() | ❌ Not Supported | | .pipe() | ❌ Not Supported | | z.custom() (e.g. Buffer) | ❌ Not Supported | | Effects with unsupported type | ❌ Not Supported | | Unknown typeName (mock types) | ❌ Not Supported | | Non-serializable transforms | ❌ Not Supported |