Server Action
ELI5 — The Vibe Check
A server action is a function that lives on the server but you can call it directly from your frontend component like it's a regular function. No manual API route, no fetch call, no JSON parsing — the framework handles all of that automatically. You write the function, mark it as a server action, and call it from your button's onClick. It's like the server is right there in your component. Magic.
Real Talk
Server actions are a framework feature (Next.js, Nuxt, SolidStart) that allows defining server-side functions that can be invoked directly from client components. The framework automatically handles serialization, network transport, error handling, and form state management. They simplify data mutations by eliminating the boilerplate of manual API endpoints, while keeping sensitive logic server-side.
When You'll Hear This
"Server actions replaced 15 API routes with 15 inline functions." / "Use server actions for form submissions — no need for a separate API route."