Skip to content

ZenStack Release v1.0.0-alpha.28

Compare
Choose a tag to compare
@ymc9 ymc9 released this 28 Jan 04:03
· 847 commits to main since this release
256815b

Road to V1

After listening to the feedback from our enthusiastic early adopters, we've decided to repackage ZenStack's features to meet the following goals:

Enhancing Prisma instead of hiding it

We started to build ZenStack because we really liked Prisma and thought it had more potential than an ORM. In pre-v1 versions, ZenStack tried to inherit the schema language from Prisma but hide it from a tooling point of view.

Feedback showed that fully replicating Prisma CLI didn't add much value. We've decided to focus on extending Prisma's schema where necessary and act like a transpiler that generates Prisma schema file into its standard location and leaves the ORM tasks - sync database schema, seeding database, generating migrations, etc., to the Prisma CLI.

Framework agnostic

Previous versions have a strong binding to Next.js at the surface, although the toolkit's core is independent. For the V1 release, ZenStack will be framework-agnostic, and there'll be integration packages and plugins for interfacing with various popular full-stack frameworks.

Flexible and extensible

The V1 release delivers its main features by wrapping standard PrismaClient instances. You can create an enhanced PrismaClient with features like access control, field validation, and field omission and use it with exactly the same API as regular Prisma.

This level of encapsulation allows more flexibility because you can use ZenStack entirely as a backend toolkit to save time writing explicit authorization code. On the other hand, you can also use it full-stack by leveraging its capability of creating RESTful services and generating client libraries to reduce your entire backend development work to a minimum (if any).

We've also exposed extensibility at the schema language level by introducing the new plugin construct. Users can implement their own plugins for custom code generation with full access to the schema's AST.

Changes

  • Simplified zenstack CLI to do only project initialization and code generation.

  • Added Prisma enhancement APIs - withPolicy, withOmit, withPassword and withPresets.

  • Added plugin construct to ZModel language for implementing custom code generation.

  • Added future() attribute function for accessing an entity's "post-update" state.

  • Extracted Next.js integration to the @zenstackhq/next package.

  • Extracted "react hooks generation" as the @zenstackhq/react plugin that can be enabled on-demand.

  • Added @zenstackhq/trpc plugin for generating tRPC CRUD routers.

  • Triple-slash comments are preserved when generating Prisma schema. Custom attributes are also output as triple-slash comments. It allows interoperability with existing Prisma generators that use the comment hack.

  • VS Code extension now supports auto-formatting.

  • Website is rebuilt with Docusaurus - better readability and better SEO.


We know it's a pretty big change, and would love to hear what you think about it. Please join our discord server and let's chat!