Search code examples
next.js

Meaning of parentheses () in Next.js path


For example (auth):

enter image description here

I was struggling to how to find correct path when () in the folder. I took a project from GitHub. Can anyone explain me how can I handle that?


Solution

  • When using the app (as opposed to pages) router, parentheses around a directory name indicate route groups:

    Route groups can be created by wrapping a folder in parenthesis: (folderName)

    This indicates the folder is for organizational purposes and should not be included in the route's URL path.

    In your example the routes would be mapped to e.g. /create-password, not /auth/create-password.