Server Actions

A Server Action is an asynchronous function that runs on the server, callable from a component or a form, marked with the 'use server' directive. It is used to modify data without writing an API route. It remains a public entry point: you must validate inputs and check access in it.

Example

'use server'
export async function creer(formData: FormData) {
  // validate then save
}

Related concepts

The whole glossary