nuxt-precognition

Nuxt module implementing Precognition protocol (inspired by official Laravel Precognition) for backend precognitive validation.
3,621 18
Install
npm install nuxt-precognition
Latest Version:0.3.1
Vue:3
License:MIT
Last Updated:Aug 13, 2026
Links: GitHub  ·  npm
Maintainer: sot1986

Nuxt Precognition

npm version npm downloads License Nuxt

Nuxt Precognition is a validation module for Nuxt that implements the Precognition protocol in a backend-agnostic way. It supports any backend or validation library, and is not tied to Laravel.

Requirements

  • Nuxt >= 3.x
  • Node.js >= 18

Why Nuxt Precognition?

  • Backend agnostic: Works with any backend that supports the Precognition protocol.
  • Validation library agnostic: Use Zod, Yup, or any other validation library.
  • Client & server side validation: Seamless validation on both ends.
  • Optimal TypeScript support: Typesafe forms and error handling.
  • Highly customizable: Plug in your own error parsers and status handlers.

Quick Example

interface User {
  email: string
  password: string
}

const form = useForm(
  (): User => ({ email: '', password: '' }),
  (body, headers) => $fetch('/api/login', { method: 'POST', headers, body })
)

Official Documentation


Installation

Install the module in your Nuxt app:

npx nuxi module add nuxt-precognition

Contributing

# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release

License

MIT © [sot1986]

Related Packages

nuxt-laravel-precognition

Nuxt module to work with Laravel Precognition and $fetch

2,009 10
@sidebase/nuxt-parse

Parse, validate and transform data with confidence in nuxt using `zod`

12,669 54
laravel-precognition-vue

Laravel Precognition (Vue).

598,846 175
@awes-io/nuxt-laravel

AwesCode UI module for connection with Laravel backend

7,075 9

Version History

Version Released Vue License
0.3.1 ^3.0 MIT
0.3.0 ^3.0 MIT
0.2.0 ^3.0 MIT
0.1.7 ^3.0 MIT
0.1.6 ^3.0 MIT