Next.js Intercepting Routes: Build Modals, Parallel Routes and Role-Based Dashboards

A user clicks a photo in a feed and a modal opens. They copy the URL, send it to a friend, and the friend sees a full photo page instead of a modal. The user presses refresh and the modal doesn't vanish. They press the browser's back button and the modal closes instead of throwing them out of the app.

That is the behavior people expect from a good modal, and it is very hard to build with component state alone. The Next.js App Router solves it at the routing layer with two file-system conventions: parallel routes and intercepting routes. Used together, they give you URL-addressable modals, independently streaming dashboard panels, and layouts that render different content depending on who is signed in.

This guide explains the mental model first, then builds a working modal system step by step. It then covers conditional dashboards, the security detail that most tutorials skip, a debugging checklist, and when not to use any of this. Everything here is checked against the official Next.js documentation, which is linked at the end.

Key takeaways

  • Slots (@folder) are not URL segments. They are named regions that your layout receives as props.
  • Intercepting routes only trigger on soft (client-side) navigation. A refresh or a direct visit always renders the real route.