Engineering 2025-06-20 6 min read

Why We Switched to Server Actions for All Form Handling

#Code#React#Tutorial

Goodbye, API Routes

Before Next.js 14, handling a simple contact form meant creating an API route /api/contact, handling JSON parsing, validation, and response codes. Then the frontend had to manage loading states, fetch requests, and error parsing.

Server Actions change the game. You define a function that runs on the server, and call it directly from your button or form.

Type-Safe by Default

Because the action is just a function, you get end-to-end type safety without generating complex types or using TRPC (though TRPC is great too). Zod validation happens right inside the action.

Progressive Enhancement

Forms work even before JavaScript loads (if designed correctly), making your SaaS feel instant and robust.

We now use Server Actions for:

  • Login/Register flows
  • Data mutations (Create/Update/Delete)
  • Stripe Checkout session generation

Enjoyed this article?

We help SaaS founders solve these specific engineering challenges every day.