---
title: "Discussion on \"Clerk auth in Next.js: from authMiddleware to proxy.ts and auth.protect()\" | Hashnode"
description: "Discussion on \"Clerk auth in Next.js: from authMiddleware to proxy.ts and auth.protect()\". My 2023 Clerk demo guarded every route from authMiddleware. What replaced it in Next.js 16: clerkMiddleware() in proxy.ts and auth.protect() per page."
url: "https://hashnode.com/posts/clerk-nextjs-middleware-auth-protect/6af4288fcd5632b57c8e2be9"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Clerk auth in Next.js: from authMiddleware to proxy.ts and auth.protect()](https://mohamedgado.hashnode.dev/clerk-nextjs-middleware-auth-protect?utm_source=hashnode&utm_medium=feed)

My 2023 Clerk demo guarded every route from authMiddleware. What replaced it in Next.js 16: clerkMiddleware() in proxy.ts and auth.protect() per page.

1d ago · 7 min read · mohamedgado.hashnode.dev  
Read the article

-   [#nextjs](https://hashnode.com/tag/nextjs)
-   [#clerk](https://hashnode.com/tag/clerk)
-   [#authentication](https://hashnode.com/tag/authentication)
-   [#reactjs](https://hashnode.com/tag/reactjs)

## Written by

[Mohamed Gado](https://hashnode.com/@mohamedgado)

@mohamedgado · Tanta, Egypt

  
[View profile](https://hashnode.com/@mohamedgado)

Senior Software Engineer · React, Next.js, React Native · Building Masareef & Rafiq

Senior Software Engineer with 6+ years building web and mobile products in React, Next.js and React Native. I build and ship Masareef and Rafiq on my own. Originals live at mohamedgado.com/writing.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
