I also share a Github Repo you can check out too that goes along well with the video.
🍿 Weekly Snack: 'server-only' vs 'use server'
Next.js has two easily confused directives: 'use server' and server-only.
💡 server-only has nothing to do with Server Actions.
'use server' marks a function to run on the server and be exposed as an HTTP endpoint — that’s a Server Action.
But it doesn't prevent the file from being imported in a client component — which causes runtime failures, often in production.
That’s why server-only exists: It enforces a hard boundary, throwing an error if you import server code on the client — so mistakes fail early, not late.
use server vs server-only
✅ 'use server'
→ Specifically for Server Actions
→ This function is allowed to run on the server only, and can be called from the client via form submissions or imperative actions
→ Enforced at runtime, not build time
✅ server-only
→ Not related to Server Actions at all
→ Just a safety guard 🔐 that says: “This file must never be used in a client component or client context”
→ Enforced at build time, not runtime
⚠️ Key TakeAways
→ Don’t use server-only on Server Actions but for database helpers, private APIs, or files that access environment variables. → You can’t rely on 'use server' to protect sensitive server modules.
→ Use them side-by-side in a project, but not in the same file.
🚀 Latest Frontend News
🧰 Supabase dropped their official UI Library ↗ — built with ShadCN registry, works with React, Next.js, TanStack. Includes login, dropzone, real-time avatars/chat, and AI prompts.
⚡ Vite published a dev server security patch. Update if you're on any of these versions: 6.2.4, 6.1.3, 6.0.13, 5.4.16, 4.5.11