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

@kamaalio/joi-to-zod-codemod

v0.0.13

Published

A powerful CLI tool and library for automatically converting [Joi](https://joi.dev/) schema definitions to [Zod](https://zod.dev/) schemas in TypeScript and JavaScript projects. This codemod intelligently transforms validation schemas while preserving com

Downloads

17

Readme

Joi to Zod Codemod

A powerful CLI tool and library for automatically converting Joi schema definitions to Zod schemas in TypeScript and JavaScript projects. This codemod intelligently transforms validation schemas while preserving complex relationships, nested structures, and import dependencies.

Installation

# Using npm
npm install -g @kamaalio/joi-to-zod-codemod

# Using pnpm
pnpm add -g @kamaalio/joi-to-zod-codemod

# Using yarn
yarn global add @kamaalio/joi-to-zod-codemod

Usage

CLI Usage

Transform all Joi schemas in the current directory:

joi-to-zod-codemod

Transform specific directory:

joi-to-zod-codemod run ./src

CLI Options

| Flag | Short | Default | Description | | ------- | ----- | ------- | ---------------------------------------- | | --dry | -d | false | Preview changes without writing to files | | --log | -l | true | Enable logging output |

Examples

# Dry run to preview changes
joi-to-zod-codemod run --dry

# Transform specific directory with minimal output
joi-to-zod-codemod run ./api --no-log

Transformation Examples

Basic Schema Conversion

Before (Joi):

import Joi from 'joi';

const userSchema = Joi.object({
  name: Joi.string().min(3).max(30).required(),
  email: Joi.string().email().required(),
  age: Joi.number().integer().min(18).max(120),
});

After (Zod):

import { z } from 'zod';

const userSchema = z.object({
  name: z.string().min(3).max(30),
  email: z.string().email(),
  age: z.number().int().min(18).max(120).optional(),
});

Development

Prerequisites

  • Node.js >=22.0.0
  • pnpm (recommended package manager)

Setup

# Clone the repository
git clone https://github.com/kamaal111/joi-to-zod-codemod.git
cd joi-to-zod-codemod

# Install dependencies
pnpm install

# Build the project
pnpm build

# Run tests
pnpm test

# Run tests with coverage
pnpm test:cov

Scripts

  • pnpm build - Compile TypeScript and prepare for distribution
  • pnpm test - Run test suite
  • pnpm test:watch - Run tests in watch mode
  • pnpm test:cov - Run tests with coverage
  • pnpm lint - Run ESLint
  • pnpm format - Format code with Prettier
  • pnpm type-check - Run TypeScript type checking

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Kamaal Farah - GitHub


Transform your validation schemas with confidence! 🧉