Server Action
Async function tagged with "use server" directive — bundles never sent to client, callable from client-side via auto-generated RPC bridge. Next.js 13.4+, React 19. Replaces API routes for many CRUD flows.
async function deletePost(id) { "use server"; await db.delete(id); } — imported from client component, framework generates fetch stub. Native form actions: <form action={createPost}>, no JS required for basic submit. Trade-off: less explicit than REST API (no clear API surface), debugging harder. Competitor: tRPC (type-safe RPC), Remix actions (similar concept), GraphQL mutations. Modern Next.js stack: RSC + Server Actions + Drizzle ORM = "no traditional API layer" mentality.