prefer-server-actions
Prefer Next.js Server Actions over same-origin API mutations.
Why
Server Actions can remove a hand-written internal API wrapper while retaining typed application calls. Client invocations still cross a network and serialization boundary.
Fix
Consider a Server Action for application-owned mutations; preserve authorization, input validation and any public API consumers.
Examples
"use client";await fetch("/api/tasks", { method: "POST", body });import { createTask } from "./actions";await createTask(input);