Rendering

Data access layer and DTO

Application pattern, not a framework API. Verify access at the data boundary and explicitly construct minimal public output. Source: https://nextjs.org/docs/app/guides/data-security

Formal Syntax & Structure

nextjs syntaxnextjs
async function getPublicBook(slug: string) { /* validated access and projection */ }

Working Example

Example Snippetnextjs
type BookRow = { slug: string; title: string; priceCents: number; supplierNote: string; published: boolean };export function publicSummary(row: BookRow) {  if (!row.published) return null;  return { slug: row.slug, title: row.title, priceCents: row.priceCents };}
Next.js Reference