Built-in Plugins
ZenStack ships with a set of built-in plugins. They fall into the following two categories.
Core Plugins
Most of the core functionalities of ZenStack are implemented as or supported by a few core plugins. They're vital to the operation of ZenStack and are enabled automatically as needed. Core plugins are implemented inside the zenstack
npm package and have names starting with @core/
.
Here's a quick overview of them:
-
Transforms ZModel to Prisma schema and runs
prisma generate
to generate Prisma Client. -
Transforms ZModel to lightweight Javascript to be used at runtime.
-
Transforms access policies into partial Prisma query objects for injecting Prisma queries at runtime.
-
Transforms ZModel into Zod schemas for validating input data at runtime.
The ZenStack CLI automatically decides whether a core plugin should be enabled based on the ZModel. You can also explicitly declare a core plugin to override its options. For example, declare a @core/prisma
plugin to output the generated Prisma schema file to a custom location:
plugin prisma {
provider = "@core/prisma"
output = "src/db/prisma/schema.prisma"
}
Maintained Plugins
Besides core plugins, the ZenStack team maintains a set of useful but non-essential plugins. They are implemented in separate npm packages under the @zenstackhq
organization.
-
Generates frontend data query hooks for targeting Tanstack Query. In Part III and Part IV of this guide, you'll learn more about using ZenStack for full-stack development.
-
Generates frontend data query hooks for targeting SWR. In Part III and Part IV of this guide, you'll learn more about using ZenStack for full-stack development.
-
Generates tRPC routers for database queries and mutations.
-
Generates OpenAPI specs from the ZModel schema.