Practical, Secure Authentication in Next.js with iron-session & Server Actions
Encrypted, cookie-based, stateless sessions: a login, protected page and logout flow built step by step with iron-session and Server Actions.
Notes on what I build and learn along the way.
Encrypted, cookie-based, stateless sessions: a login, protected page and logout flow built step by step with iron-session and Server Actions.
tailwind.config is gone and @theme takes its place. Defining a theme with CSS variables in Tailwind v4, dark mode, and new features like color-mix and not-*, with examples.
What middleware is and when to use it: matchers, has/missing filters, rewrites, cookie and header handling, and returning custom responses from middleware, with examples.
Type-safe validation with Zod schemas, wiring them into React Hook Form with zodResolver, and deriving TypeScript types from a schema: modern form validation, with examples.
Which components should run on the server and which in the browser? The difference between Server and Client Components, the 'use client' directive, and the security angle, with examples.