# Server Actions ## Basic Server Action ```tsx // app/actions.ts 'use server' import { db } from '@/lib/db' import { revalidatePath } from 'next/cache' export async function createPost(formData: FormData) { const title = formData.get('title') as string const content = formData.get('content') as string await db.post.create({ data: { title, content } }) revalidatePath('/posts') } ``` ## Form with Server Action ```tsx // app/posts/new/page.tsx import { createPost } from '@/app/actions' export default function NewPost() { return (