Tagged Next.js
7 articles
Validate Next.js Server Actions with Zod (and Authorize Them)
Server Actions are public POST endpoints. How to validate every input with Zod, check authentication and authorization inside each action, return safe errors to forms, and keep secrets and database logic server-only.
Timezone Bugs in Web Apps: The Ones We Actually Hit
Real timezone bugs from a production app — a due date showing the previous day, "today" starting at the server's midnight, server-rendered times in the wrong zone — why each happened, and the rules that prevent them.
How to Build an Internal Help Desk with Next.js and Supabase
The architecture behind a production internal request desk — Postgres row-level security for tenancy, SLA timers the database computes, and AI that helps but never blocks — on free tiers.
Next.js App Router + Supabase Auth: The SSR Setup That Works
Two clients, a proxy that refreshes the session, getClaims or getUser instead of getSession, and a layout gate — the Supabase SSR auth setup for the Next.js App Router, with the mistakes that cause random logouts and leaks.
Streaming AI Responses in Next.js: Plain Streams vs SSE
How to stream LLM answers from a Next.js Route Handler to the browser — a plain ReadableStream or Server-Sent Events, reading it with fetch, saving before the stream closes, and falling back when the model fails mid-answer.
Rate Limiting API Routes Without Redis (Using Postgres)
A per-user rate limiter built in Postgres — a hits table, a sliding window, an advisory lock against races, and a cleanup job — plus per-IP limits for login, and when you really do need Redis.
Free Transactional Email with Resend (Next.js Guide)
Send invites, password resets and notifications from a Next.js app on Resend's free tier — one fetch call, a verified domain, SPF/DKIM/DMARC, a graceful no-op when unconfigured, and what the limits mean in practice.