Server Action
Async function tagged med "use server"-directive — bundles never sent to client, callable från 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 från client component, framework genererar fetch-stub. Native form-actions: <form action={createPost}>, ej JS-required för basic submit. Trade-off: less explicit än REST-API (no clear API-surface), debugging harder. Konkurrent: tRPC (type-safe RPC), Remix actions (similar concept), GraphQL mutations. Modern Next.js stack: RSC + Server Actions + Drizzle ORM = "no traditional API layer" mentalitet.