🍿 Stop Putting Auth in Middleware (and a surprise for you)


Hey Reader,

Middleware got renamed to Proxy in Next.js 16. Same functionality. Better name.

What is Proxy? Every request to your app has to go somewhere - a page, an API route, a file. Proxy gets to look at it first and decide what happens: send the user somewhere else, serve different content silently, or just let it through as-is.

Think of it as a traffic controller 🚦 sitting in front of your routes.

So, why you should stop putting auth in Proxy?

It feels like the perfect place but it isn't. Developers started throwing auth and session logic into middleware. That's not what it's for. "Middleware" kept getting confused with Express middleware too. That's exactly why it got renamed.

So where should you do it? Next to the data access layer i.e. fetching the data or where you need it.

Here's how proxy should be,

But there is another very important reason too

In March 2025, a CVE disclosed that Next.js uses an internal header called x-middleware-subrequest to prevent infinite loops. The problem? An attacker could spoof it and Next.js would skip all middleware checks entirely.

That's also why auth should NOT live in Proxy.

πŸ’‘ Takeaway

β†’ Use Proxy for redirects, rewrites, headers, A/B tests

β†’ Move auth into Server Components, Route Handlers, or Server Actions

πŸš€ Latest Frontend News

LIBRARY UPDATES

​Astro 6.0 is out and it basically catching up to Next.js's feature set (native font optimization, route caching, CSP, better SSR) but users have to explicitly choose which ones to enable

A React framework built for Cloudflare is now out of beta and full stable

​TanStack AI Open Router lets you hit GPT-5, Claude, Gemini, Llama, DeepSeek and more, all through one API

A new CLI tool by TanStack that helps library maintainers generate and ship Agent Skills alongside their npm packages

​shadcn/cli v4 is out - this is a HUGE update. Previously, changing fonts, colors, icons, or component library meant manually updating multiple files. Now a single --preset flag with a short string like AKG33FG restyles your entire design system.

TypeScript 6.0 is now available as a release candidate, go try it (with caution) before it officially ships

​Prisma ORM 7.5.0 just shipped with Nested transaction rollbacks via save-points, Run raw SQL in Studio and a lot more.

GREAT READ

​Slim lets you share your local dev server with a public URL, no tunneling headaches

How does a Fast Rust bundler for JS/TS handle chunking and dependency graphs for faster builds and bundles

​Next.js installs will soon include version-matched docs, giving agents context on new and recently updated APIs.

AI

Claude Code just killed a bunch of startups as it now has built-in code review - it can analyze pull requests, flag issues, and suggest improvements before you merge

Ask Side Questions while your main task keeps running in Claude Code?, /a new tool by claude code​

Remember the hype around Cloudflare's Next.js alternative? Well, there are multiple critical security flaws​


πŸ™ Your Feedback helps shape the newsletter

Make sure to keep sharing your feedback by clicking one of the links below. I'm listening πŸ‘€ .
​​
​
πŸ”₯ Love it!​

β€‹πŸ˜ It’s okay​

β€‹πŸ‘Ž Not good​

If you’ve published a blog post or shipped something, feel free to reply to this email and it comes straight to my inbox. I’m always looking for great community work to consider featuring.

All past newsletters can be found here. You can email me at me@kulkarniankita.com to advertise/sponsor the newsletter.

For those curious, I write all my emails using Convertkit.

If you’d like to keep learning, you can grab yourself a copy of the course:

β†’ Buy a copy of The Modern Full Stack Next.js Course πŸ’–

Use code: FLASH40 for 40% off or use the ppp code from the banner on the website, whatever is cheaper.

See you next week!

Ankita Kulkarni

Join 9200+ subscribers reading by weekly personalized Newsletter that helps developers level up their skills through weekly Frontend and Leadership Snacks. You get a deep dive into a Tech topic, Actionable tips to excel in your career and a toolbox!

Read more from Ankita Kulkarni
A terminal interface displays commands for a tool called next-browser, designed for AI agents to analyze and monitor Next.js applications.

Hey Reader, This week, Next.js 16.2 gave AI agents something they never had "a browser". Your agent can now see your app, find the problem, and fix it without asking you. This along with GPT-5.4 mini & nano (2 small models), TanStack Start going 5x faster, why you should ban useEffect, and more. Let's dive in. 🍿 Our Weekly Snack: Your AI agent can finally see what your users see (Next.js 16.2 is here) Next.js 16.2 dropped yesterday (deep dive here) and it just gave AI agents a browser. It's...

You’re Suspending the Wrong Component

Hey Reader, There are thousands of you going through Modern Full Stack Next.js Course so wanted to be grateful here for your support. Just as a thank you, there is something big dropping for you. It will only last 24 hours ⏰ so keep an eye out for my email next week. Let's dive in! PRESENTED BY CLERK Instead of your coding agent guessing how auth works, you can now install specialized Clerk knowledge directly into it. Introducing Clerk Skills One simple command $ npx skills add clerk/skills...

Next.js bundle analyzer

Hey Reader, This week, we're putting your Next.js app under the microscope, what's slowing it down? This along with the latest news, can AI really debug complex React/Next.js bugs? How OpenClaw and Anthropic are enabling AI collaboration, 3 New Coding Models dropped and more. Let's dive in! 🍿 Our Weekly Snack: What's Really Slowing Down Your Next.js App? Have you ever wondered why your Next.js app feels sluggish or takes forever to load? 🐌 The new experimental Bundle Analyzer in Next.js 16.1...