Part 8: Adding RBAC to blog-demo — Teaching Prisma Who Can Do What
In this post, we'll add a simple RBAC (Role-Based Access Control) rule to blog-demo.
Footprints
Open the places and fragments left along the way
constructionTools
A growing place for small tools and experiments
codeOpen Source
Sharing and documenting excellent open source projects worth following
personAbout
Learn who I am and what this site keeps circling back to
Theme
Switch to a reading atmosphere that fits the moment
Language
Switch the language of articles and moments
Recent Status
The update frequency of Codex App is too extreme, almost daily updates.
Tag
Long-form notes and shorter moments filed under “Development”.
In this post, we'll add a simple RBAC (Role-Based Access Control) rule to blog-demo.
In this part, we'll do three things: integrate a minimal login system (Auth.js / NextAuth style) into the project; require users to be logged in for creating new articles and posting comments in blog-demo; and in API Routes, retrieve the current user ID from the session instead of using a hardcoded authorId.
In previous parts, we took a backend-focused approach with Prisma to build the data model and business logic for blog-demo. In this part, we integrate that model into Next.js to create a minimal yet complete personal blog admin panel.
In the previous article, we designed a set of relational models for blog-demo: User / Profile / Post / Comment / Category. It's functional, but still at the "structural level." In this section, I want to take a different approach: instead of explaining by concepts, I'll walk through a complete business workflow.
Starting from this chapter, we move from a single-table world with only User to a multi-table world with real business semantics: the blog-demo blog system.
The goal of this article is to break down the Prisma schema from top to bottom — explaining datasource, generator, model, enum, and all the attributes: what they are and how to use them.
In this article, we jump straight into a real project: using Prisma 7 + Next.js 16.2.2 + PostgreSQL + pnpm, we go from an empty directory to displaying the first User record from the database on the page.
The MVP (Minimum Viable Product) mindset is essentially about validating whether an idea is worth pursuing — at a lower cost.
When React Native 0.85 was released, the official announcement avoided using the term 'revolutionary' — because this update is essentially a systematic polish of infrastructure like animations, debugging, and testing, building on the foundation of the new architecture.
Many frontend engineers feel a bit confused when first encountering MCP: it sounds like a protocol, acts like an Agent, and discussions are full of Tool, Prompt, Resource, and Skill. But you don't need to digest all these terms at once. Just remember this one sentence: MCP is a standardized way for AI to connect tools, access data, and actually get things done.