Deviopath › Next.js

Folder Name Types

Easy · Routing

The name of a folder in app/ decides how it behaves in the URL.

Write segmentType(folder) that returns:

- "optional catch-all" for [[...name]] (matches the route with or without extra segments)

- "catch-all" for [...name] (matches one or more segments)

- "dynamic" for [name] (matches one segment, like [slug])

- "group" for (name): a route group, used to organize files; it is left out of the URL

- "parallel" for @name: a slot for parallel routes

- "private" for _name: a private folder, excluded from routing

- "static" for anything else

Next: Public Environment Variables