- All Courses
- Next.js App Router in Depth
- Server Actions and Mutations
- Writing your first server action
Writing your first server action
A server action is a function that only ever runs on the server but can be called from the client. It replaces the route handler you would otherwise write by hand.
- 8m
- Intermediate

Video by Beyond Fireship · YouTube
Check your understanding
3 questions. Unlocks when you finish the video.
Overview
What this lesson covers
- Define an action and call it from a form or an event
- Revalidate the affected data after a write
- Keep write credentials on the server side of the call
This lesson sits in Server Actions and Mutations, part of Next.js App Router in Depth. It assumes what came before it and leads directly into the next lesson in the module.
In this lesson you will:
- Define an action and call it from a form or an event
- Revalidate the affected data after a write
- Keep write credentials on the server side of the call
Resources
Your notes will live here
Note taking is not available yet. Nothing you type would be saved, so the tab stays read-only for now.