🍿 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
cut ai bill in half

Hey Reader, I checked my Claude usage last week and found out I’d been paying max-effort prices to rename variables. Three small changes later, my bill is half what it was. This week: the 3 fixes that saved me the most, a Next.js patch you need today, and Opus 5.5 making motion graphics by writing code. One small favour first: I’m building my AI course and need your help. It will only take 60 seconds. β†’ Click here for feedback PRESENTED BY SONARQUBE We all hate security scanners that flood...

Hey Reader, I've been heads down focusing on crafting my AI course. I'm still in early stages and need your help. Can you fill this quick survey that should take less than a minute and give me your feedback? β†’ Click here for feedback PRESENTED BY SONARQUBE We all hate security scanners that flood our PRs with false positives. It's the quickest way to get a dev to ignore alerts altogether. SonarQube Hunter Agent is different. It’s an AI-powered agent that hunts for business logic flaws and...

Hey Reader, The biggest challenge with AI right now isn't building from scratch or brainstorming, it's great at both. It's building real intuition for how things should work. Take how TikTok and YouTube handle video. If they served the same file to every device, tablet, mobile, desktop, even a slow 3G connection, users would drop off fast. So how would you solve that? Don't worry, let me show you. Here's how to architect for exactly this challenge. PRESENTED BY IMAGEKIT Don't throw raw MP4s...