Playground
Getting Started

Installation

How to install zod-mongoose in your project.

Installation

Install the package using your favorite package manager:

pnpm add @nullix/zod-mongoose zod/v4

Or with npm:

npm install @nullix/zod-mongoose zod/v4

Or with yarn:

yarn add @nullix/zod-mongoose zod/v4

Peer Dependencies

This package requires zod (^4.x). Note that zod imports must be from zod/v4 to ensure compatibility.

mongoose (^8.x) is an optional peer dependency. It is only required on the backend when calling toMongooseSchema(). You do not need to install mongoose on the frontend.