Next.js is evolving fast to become an increasingly appealing choice for building full-stack web apps. However, coding up the backend part of an app, especially implementing CRUD services efficiently and securely, is still tricky (and boring π too).
ZenStack is a toolkit that simplifies the construction of CRUD services with a schema-first approach. It offers a modeling language for defining data models, relations, and access policies and then generates RESTful CRUD services (with authorization) and React hooks for you. It also allows you to share types between client and server-side coding and achieve end-to-end type safety without pain.
Our goal is to let you save time writing boilerplate code and focus on building what matters - the user experience.
If it feels relevant, please also check out the excellent detailed tutorial by @jiasheng for how to use it in action:
How to Build a Production-Ready Todo App in One Next.js Project With ZenStack
JS for ZenStack γ» Nov 10 '22 γ» 22 min read
, or find more details directly at Github:
zenstackhq / zenstack
Supercharges Prisma ORM with a powerful access control layer and unlocks its full potential for web development.
What it is
ZenStack is a toolkit that simplifies the development of a web app's backend. It supercharges Prisma ORM with a powerful access control layer and unleashes its full potential for web development.
Our goal is to let you save time writing boilerplate code and focus on building real features!
How it works
ZenStack extended Prisma schema language for supporting custom attributes and functions and, based on that, implemented a flexible access control layer around Prisma.
// schema.zmodel
model Post {
id String @id
title String
published Boolean @default(false)
author User @relation(fields: [authorId], references: [id])
authorId String
// π allow logged-in users to read published posts
@@allow('read', auth() != null && published)
// π allow full CRUD by author
@@allow('all', author == auth())
}
At runtimeβ¦
Also, join us on discord for chat and the latest updates!
Have fun!
Top comments (0)