The use server directive and Server Functions
Answer: "use server" marks a function or file to run on the server. Those Server Functions can be imported into Client Components; in mutation contexts they are Server Actions.
Directive
The use server directive designates a function or file to be executed on the server. All functions in a "use server" file run on the server.
Calling from the client
Create Server Functions in a dedicated file, then import them into Client Components to execute them.
Return values
Server Function return values are serialized and sent to the client. Return only what the UI needs.
See also
Claims
- id: C1 claim: use server runs code on the server. source: S1 evidence: "The
use serverdirective designates a function or file to be executed on the **server"
- id: C2 claim: Import Server Functions into Client Components. source: S1 evidence: "To use Server Functions in Client Components you need to create your Server Functions in"
- id: C3 claim: Return values are serialized to the client. source: S1 evidence: "Server Function return values are serialized and sent to the client."
- id: C4 claim: Mutation context calls them Server Actions. source: S2 evidence: "In an
actionor mutation context, they are also called Server Actions."
Sources
- [S1] use server. Next.js docs. https://nextjs.org/docs/app/api-reference/directives/use-server . License: MIT (vercel/next.js). Accessed 2026-11-09.
- [S2] Mutating data. Next.js docs. https://nextjs.org/docs/app/getting-started/mutating-data . License: MIT (vercel/next.js). Accessed 2026-11-09.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Copyright (c) 2025 Vercel, Inc. Sources: Next.js docs (vercel/next.js on GitHub / nextjs.org), MIT (https://raw.githubusercontent.com/vercel/next.js/canary/license.md). Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Next.js docs, use server, MIT (vercel/next.js); Next.js docs, Mutating data, MIT (vercel/next.js). Copyright (c) 2025 Vercel, Inc. MIT (https://raw.githubusercontent.com/vercel/next.js/canary/license.md).
Cite this
iinventedlight. 2026. "The use server directive and Server Functions." iinventedlight Library, iil:note:khwcwmbs, version of 2026-11-09. https://iinventedlight.com/library/notes/nextjs-use-server/. License: CC-BY-4.0.
@misc{iil_note_khwcwmbs,
author = {{iinventedlight}},
title = {{The use server directive and Server Functions}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-09},
url = {https://iinventedlight.com/library/notes/nextjs-use-server/},
note = {Permanent ID iil:note:khwcwmbs. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/nextjs-use-server.md.