A function marked use server is callable from the client, and runs on the server. The same form still works with no JavaScript at all.
request, read-only.[param], (group), and _-prefixed privates. Anything outside the grammar fails the build.error.tsx renders inside the layout and the frame survives. A directory that moved keeps a one-line redirect.ts, and a Server Action ends with redirect() to say where next.page.tsx or layout.tsx that exports paramsSchema makes a refused value a pathname the pattern does not answer — a genuine 404. Links take what the page receives, typed by the schema.The guide ships inside the npm package. An AI coding assistant reads the exact installed version out of node_modules/@k8ordo/server/docs/.
// src/routes/_parts/actions.ts
'use server';
export async function createTalk(_previous: FormState, formData: FormData) {
const parsed = parseForm(talkSchema, formData);
if (!parsed.success) return parsed.state;
await insertTalk(parsed.data);
redirect('/talks'); // throw されるので、この後の行は走らない
}
// src/routes/_parts/talk-form.tsx
'use client';
export function TalkForm() {
const [state, formAction] = useActionState(createTalk, {});
return <form action={formAction}>…</form>;
}