Skip to content

[Module Listing Request]: nuxt-zod #1474

@DarlanPrado

Description

@DarlanPrado

Description

Module: nuxt-zod

npm: https://www.npmjs.com/package/nuxt-zod
GitHub: https://github.com/DarlanPrado/nuxt-zod

Description

A Nuxt module that brings Zod into your app with auto-imported composables, a $zod plugin, and first-class server-side support via Nitro. It gives you a Nuxt-native Zod workflow with zero boilerplate — no manual imports needed across components, pages, or server routes.

Key Features

  • 🔌 Auto-imported useZod() composable — available in components, pages, and Nitro server routes
  • 📁 useZodSchemas() — auto-discovers shared Zod registries from shared/schemas/ with full TypeScript inference
  • 🛠 $zod plugin accessible anywhere via useNuxtApp()
  • event.validate() on H3Event — validate body, query, and params with typed results and configurable 422 errors
  • 🌍 Global Zod issue messages via app.config.ts for both Nuxt app and Nitro
  • 🌐 Explicit #nuxt-zod/server alias for static analysis and tree-shaking
  • 📦 Compatible with Zod v3 and v4, Nuxt 3 and Nuxt 4
  • 🏷️ Full TypeScript augmentation for NuxtApp and Vue component instances

Why nuxt-zod?

Zod is one of the most widely used validation libraries in the TypeScript ecosystem. However, integrating it properly into Nuxt requires manual setup in every component, page, and server route. nuxt-zod solves this by treating Zod as a first-class Nuxt citizen — similar to how $fetch or useRuntimeConfig work out of the box.

The event.validate() extension for H3Event is especially useful in fullstack Nuxt apps, replacing several lines of boilerplate per route with a single typed call that handles body, query, and params simultaneously.

Repository

https://github.com/DarlanPrado/nuxt-zod

npm

https://www.npmjs.com/package/nuxt-zod

Nuxt Compatibility

Nuxt 4, Nuxt 3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions