Skip to content

Introduction

Nuxt Zenstack is a module that seamlessly integrates ZenStack into your Nuxt application. It supercharges your development by providing:

  • Auto-generated server endpoints for every data model defined in your ZModel schema.
  • 🛡️ Type-safe client composables for effortless CRUD operations, fully backed by a smart cache.
  • 📦 Normalized Client Store to smartly merge, cache, and sync state across your entire app.
  • 📡 Realtime updates via Server-Sent Events (SSE) to react instantly to data mutations.

How it works ⚙️

ZModel Schema


ZenStack CLI (code generation)

    ├── Server: Auto REST endpoints (/api/_zenstack/...)
    │           ZenStack Client

    └── Client: Typed composables
                Normalized store
                Optional SSE subscriptions

Installation

sh
npx nuxi@latest module add @becem-gharbi/nuxt-zenstack
npm i @zenstackhq/orm @zenstackhq/plugin-policy
npm i @zenstackhq/cli -D
sh
pnpm nuxi@latest module add @becem-gharbi/nuxt-zenstack
pnpm add @zenstackhq/orm @zenstackhq/plugin-policy
pnpm add -D @zenstackhq/cli
sh
yarn nuxi@latest module add @becem-gharbi/nuxt-zenstack
yarn add @zenstackhq/orm @zenstackhq/plugin-policy
yarn add -D @zenstackhq/cli