Server Components vs Client Components — The Decision Framework
When to use server components and when to reach for "use client". Flowchart, refactoring patterns, and performance implications.
Checklist
Auto-generated from the 10 rules this article references — each links to the enforceable rule.
References
Addresses
Rules
Never hardcode API keys or secrets in source codeNever import server-only code in client componentsPush "use client" boundary as low as possibleServer components by default — client only when neededUse revalidatePath after server action mutationsUse server components for data fetching by defaultValidate all server action inputs at the boundaryType your Supabase client with generated database typesUse notFound() for invalid dynamic route paramsUse SWR or React Query for client-side real-time data
Tags
nextjssupabase
More from this skill
Explore more rules and knowledge
BeforeMerge offers hundreds of code review rules, guides, and detection patterns to help your team ship better code.