Module 06 of 10

Server Actions & Forms

Lessons

About This Module

Server Actions are async functions that run on the server and can be called straight from your components. Mark one with the "use server" directive, pass it to a form's action prop, and Next.js handles the request for you: no API route, no manual fetch, no JSON wiring. Forms that call Server Actions from Server Components can even work before JavaScript has loaded.

This module covers the full form workflow: reading FormData, validating input on the server with Zod, returning errors to the UI with useActionState (formerly useFormState), showing a pending state with useFormStatus, and refreshing cached data after a mutation with revalidatePath.

Watch the lessons in order, then continue on to Styling & Optimization.

Lessons

3 videos · 1 article
01

Next.js 15 Server Actions Crash Course

An in-depth tutorial on handling form submissions, mutating data, and running logic directly on the server with Server Actions.

02

Next JS Form Validation Using Server Actions

Walks through setting up form validation in a Next.js app with Server Actions.

03

Using Zod Form Validation and Server Actions in NextJs with useFormState Hook

Combines Server Actions, the useFormState hook and Zod validation when submitting forms in Next.js.

04

Next.js Forms with Server Actions

Robin Wieruch's written tutorial on forms in the App Router: useFormStatus, useActionState, revalidatePath, Zod validation, field-level errors and progressive enhancement.

Article