→ chapters/03-entity-actions

Card · Entity Actions

Single source of truth; Prisma lives only here.

Rules

  • Validate + authorize at the boundary.
  • Expose get*/mutations; no JSX or UI imports.
  • Called by server pages (reads) and server actions (writes).

Guarded Read

export async function getProjectById(id: string) {
return prisma.project.findUnique({ where: { id } });
}

Study Card · Chapter 03-entity-actions