You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
On the client-side, I want to use Zero instead of swr, tRPC or ZenStack-generated TanStack Query hooks, so that database queries can be updated in realtime for the user, providing a better user experience.
Zero is a sync engine that syncs data from a Postgres database to a client-side database, eliminating the need for manual data fetching, caching, and revalidation.
You put Zero in front of your database or web service, and we distribute your backend all the way to main thread of the UI.
It allows for client-side applications to subscribe to queries on the database that are automatically updated whenever the underlying data updates.
This makes it possible to build apps like Linear with UI that responds to the user instantly, with changes that sync in the background.
It also makes it possible to build collaborative apps like Notion where if another user changes some data, other users with the right permissions should see those changes too.
The problem is that using Zero requires maintaining two schemas, one for Zero's client-side database, and another one for the backend database. Keeping the two in sync (especially with permissions logic) is troublesome.
ZenStack is well-positioned to auto-generate a Zero schema from ZModel so developers don’t have to make two schemas.
Describe the solution you'd like
Support Zero as a first-party ZenStack plugin, similar to @zenstackhq/swr, @zenstackhq/trpc, and @zenstackhq/tanstack-query
The plugin should generate a Zero schema from a ZModel schema, mapping the following: tables, columns, relationships, and permissions.
This plugin should be accompanied with ZModel language features that support specifying only certain tables or columns that the client-side uses, since the client-side shouldn’t be accessing the full database.
Describe alternatives you've considered
Moving away from ZenStack and use Zero with Prisma (not preferable as I like defining my schema and permissions with ZModel)
Is your feature request related to a problem? Please describe.
On the client-side, I want to use Zero instead of swr, tRPC or ZenStack-generated TanStack Query hooks, so that database queries can be updated in realtime for the user, providing a better user experience.
Zero is a sync engine that syncs data from a Postgres database to a client-side database, eliminating the need for manual data fetching, caching, and revalidation.
It allows for client-side applications to subscribe to queries on the database that are automatically updated whenever the underlying data updates.
This makes it possible to build apps like Linear with UI that responds to the user instantly, with changes that sync in the background.
It also makes it possible to build collaborative apps like Notion where if another user changes some data, other users with the right permissions should see those changes too.
Zero has their own schema format that also specifies permissions for the client-side database, a query/mutation API for interacting with the client-side database, and data migration workflow.
The problem is that using Zero requires maintaining two schemas, one for Zero's client-side database, and another one for the backend database. Keeping the two in sync (especially with permissions logic) is troublesome.
ZenStack is well-positioned to auto-generate a Zero schema from ZModel so developers don’t have to make two schemas.
Describe the solution you'd like
Support Zero as a first-party ZenStack plugin, similar to
@zenstackhq/swr
,@zenstackhq/trpc
, and@zenstackhq/tanstack-query
The plugin should generate a Zero schema from a ZModel schema, mapping the following: tables, columns, relationships, and permissions.
This plugin should be accompanied with ZModel language features that support specifying only certain tables or columns that the client-side uses, since the client-side shouldn’t be accessing the full database.
Describe alternatives you've considered
Moving away from ZenStack and use Zero with Prisma (not preferable as I like defining my schema and permissions with ZModel)
Additional context
There is already a community-made Prisma generator (https://github.com/Passionfroot/prisma-generator-zero) that generates a Zero schema from a Prisma schema, but it doesn’t support permissions.
ZModel is more suited to generate permissions code.
The text was updated successfully, but these errors were encountered: