Skip to main content
Version: 2.x

🙋🏻 FAQ

Is ZenStack implemented with Postgres RLS (row-level-security)?

No, it is not implemented with Postgres RLS. Instead, ZenStack applies access control rules by injecting into Prisma's query arguments and (in certain scenarios) conducting post-query filtering. The choice brings several benefits:

  1. Database agnostic: ZenStack works with any database that Prisma supports.
  2. No need to create migrations when changing access control rules.
  3. A significantly simpler syntax for access control rules compared to SQL RLS.
  4. Collocating access control rules with the data model.

Does using ZenStack introduce more connections to my databases?

No. It's common to create enhanced PrismaClient wrappers per request (for binding to different user identity). Under the hood all such wrappers share the same PrismaClient instance and thus the same database connection.

Is ZenStack framework-agnostic?

Yes, ZenStack is framework-agnostic. The core of ZenStack's runtime is a transparent proxy wrapping a PrismaClient, so it can be used in any framework that can run Prisma. ZenStack already provides adapters for popular frameworks like Next.js and Fastify, and more are being made. It's also easy to write your own adapters.

How to use ZenStack in a monorepo setup?

To use ZenStack in a monorepo setup (e.g., pnpm workspace), run zenstack init in the package where schema.prisma resides (usually also where the global prisma instance is exported). There's no need to install ZenStack-related packages at the workspace level.

Is ZModel fully compatible with Prisma Schema?

The ZModel language is designed to be a superset of Prisma Schema. The major extension that ZModel made to Prisma schema today are:

Using a separate DSL gives us the flexibility to add more extensions in the future; however, the goal is to maintain the "superset" positioning, i.e., every valid schema.prisma is a valid schema.zmodel.

In practice, you may run into problems that the schema.prisma generated by ZenStack triggers validation errors in prisma CLI. This is because Prisma CLI has many validation rules, some quite subtle. We try to replicate those rules in zenstack CLI, but it's more of a best-effort approach. Fortunately, the errors reported by prisma CLI usually give pretty good hints on what to change in schema.zmodel.

We will continue improving the parity between ZModel and Prisma Schema regarding validation rules.

Does ZenStack require a specific Prisma version?

No. ZenStack references Prisma as a peer dependency and works with Prisma 5.0.0 and above.

Does ZenStack work with Prisma migration?

Yes. When you run zenstack generate it generates a standard Prisma schema file that can be used with Prisma migration.

Are there any other IDE integrations besides VSCode?

Yes, ZenStack has integrations with VSCode and JetBrains IDEs. Please see here for ore details.

Does ZenStack work with Prisma Client Extensions?

The short answer is it works in most cases. Please refer to this guide for more details.

Feel free to ask questions, give feedback, or report issues.

Don't Spam

You can edit/delete your comments by going directly to the discussion, clicking on the 'comments' link below