๐Ÿฟ 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

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...

A code editor displays a file structure showing a new lock file generated in the Next.js directory, indicating port 3000 is occupied.

Hey Reader, Confession: i've lost count of how many times an agent has killed my running dev server and started a new one on a different port. it's the single most annoying thing about coding with AI right now. Turns out Next.js 16.2 just fixed it so dig into the snack below. let's dig in ๐Ÿฟ PRESENTED BY SUPABASE Supabase is the backend for your app: it gives you a database plus the โ€œboring but necessaryโ€ stuff around it (user sign-in, file storage, background functions, and real-time updates)...

View Transitions in Next.js

Hey Reader, I'm working on a new course on AI and I know there are a million courses out there but honestly, I'd like to work on something that can help you ship things. However, I need your help. Can you please answer what type of a course on AI would you want me to work on? Click here to reply โ†— Anyway, let's get into this week's newsletter. PRESENTED BY SUPABASE Supabase is the backend for your app: it gives you a database plus the โ€œboring but necessaryโ€ stuff around it (user sign-in, file...