Introduction
Nuxt Zenstack is a Nuxt module that integrates ZenStack V3 into your Nuxt application. It provides:
- Auto-generated server endpoints for each data model defined in your ZModel schema
- Access control enforcement using ZenStack's policy engine on every request
- Type-safe client composables for CRUD operations, backed by a normalized cache
- Realtime updates via Server-Sent Events (SSE) on data mutations
How it works
ZModel Schema
│
▼
ZenStack CLI (code generation)
│
├── Server: Auto REST endpoints (/api/_zenstack/...)
│ Policy-enforced ZenStack Client
│
└── Client: Typed composables
Normalized store
Optional SSE subscriptionsInstallation
sh
npx nuxi@latest module add @becem-gharbi/nuxt-zenstack
npm i @zenstackhq/orm @zenstackhq/plugin-policy
npm i @zenstackhq/cli -Dsh
pnpm nuxi@latest module add @becem-gharbi/nuxt-zenstack
pnpm add @zenstackhq/orm @zenstackhq/plugin-policy
pnpm add -D @zenstackhq/clish
yarn nuxi@latest module add @becem-gharbi/nuxt-zenstack
yarn add @zenstackhq/orm @zenstackhq/plugin-policy
yarn add -D @zenstackhq/cli