🌐 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)

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