π Routing
Any folder inside the src/
directory that contains a page.tsx
file is considered a route β unless the folder name starts with an underscore (_
), in which case it's ignored.
ποΈ Routing Structure
For example, given the structure:
src/
βββ test/
β βββ page.tsx
βββ test2/
β βββ page.tsx
βββ _test3/
β βββ page.tsx
βββ test4/
β βββ test1/
| βββ page.tsx
β This will create the following routes:
/test
/test2
/test4/test1
β _test3
is ignored because folders starting with _
are not routable.
π« Ignored Folders (_
prefix)
_
prefix)Folders starting with _
are excluded from routing. These are reserved for things like:
_components/
β Shared UI components_functions/
β Utility/helper logic_api/
β API request handlers_sync/
β Sync logic or services
This keeps your folder structure clean and modular without affecting the routing system.
β¨ Key Rules Summary
β
src/[name]/page.tsx
β Becomes a routeβ
src/_[name]/page.tsx
β Ignored by the routerβ Use
_
folders for internal logic, helpers, or organization
Last updated