Folders inside src/app define URL segments. Each folder becomes a part of the URL path.
Bini.js uses folder-based routing - every folder inside src/app/ becomes a URL segment. Add page.tsx inside that folder to make the route accessible.
| Folder Pattern | URL | Type |
|---|---|---|
| src/app/about/page.tsx | /about | Static folder - creates URL |
| src/app/dashboard/settings/page.tsx | /dashboard/settings | Nested folder - creates URL |
| src/app/(marketing)/about/page.tsx | /about | Route group - folder ignored |
| src/app/_components/Header.tsx | - | Private folder - no URL |
| src/app/.internal/page.tsx | - | Private folder - no URL |
Every folder becomes a URL segment. Add a page.tsx file to expose it.
Nest folders to create nested URL segments. Each nested folder adds one segment.
layout.tsx at the root wraps every page.Wrap a folder name in parentheses, like (marketing), to organize routes without adding a URL segment. The group name is dropped from the path.
Both pages are routed normally: /about and /cart. The group folders themselves never appear in the URL.
Each group can also have its own layout.tsx that wraps only the routes inside that group.
Prefix a folder with _ or . to keep it out of routing. Private folders do not create URLs. Use them to keep components, helpers, and data next to the route that uses them.
| Folder Pattern | Creates URL? | Description |
|---|---|---|
| _components | No | Private folder (underscore prefix) |
| .hidden | No | Private folder (dot prefix) |
| blog/_components | No | Private folder inside a route |
| about, blog | Yes | Public folder with page.tsx |
loading.tsx, not-found.tsx, and error.tsx use nearest-wins resolution. A file in a subfolder only affects that subfolder, and shadows the same file from a parent folder.
Resolution order: route's own folder → parent folders → built-in default.
Each folder type affects URLs differently. Static and nested folders create URL segments. Route groups and private folders do not.
| Folder Type | Example | Creates URL? |
|---|---|---|
| Static | src/app/about/page.tsx | Yes - /about |
| Nested | src/app/blog/authors/page.tsx | Yes - /blog/authors |
| Route group | src/app/(marketing)/about/page.tsx | Yes - /about (group dropped) |
| Private | src/app/_components/Header.tsx | No |
A folder-based project showing which folders create URLs and which do not.
| Folder Path | URL | Creates URL? |
|---|---|---|
| src/app/page.tsx | / | Yes |
| src/app/about/page.tsx | /about | Yes - static folder |
| src/app/blog/page.tsx | /blog | Yes - static folder |
| src/app/blog/authors/page.tsx | /blog/authors | Yes - nested folder |
| src/app/(marketing)/about/page.tsx | /about | Yes, group folder ignored |
| src/app/_components/Button.tsx | - | No - private folder |
| src/app/blog/_components/PostCard.tsx | - | No - private folder |
Define routes with flat files instead of folders.
Match URL segments with dynamic parameters and catch-alls.
Render multiple routes in the same layout with named slots.
Match any number of trailing URL segments.
Create your first pages and wrap them in shared layouts.
Learn how a Bini.js project is organized and what each folder contains.
Folders inside src/app define URL segments. Each folder becomes a part of the URL path.
Bini.js uses folder-based routing - every folder inside src/app/ becomes a URL segment. Add page.tsx inside that folder to make the route accessible.
| Folder Pattern | URL | Type |
|---|---|---|
| src/app/about/page.tsx | /about | Static folder - creates URL |
| src/app/dashboard/settings/page.tsx | /dashboard/settings | Nested folder - creates URL |
| src/app/(marketing)/about/page.tsx | /about | Route group - folder ignored |
| src/app/_components/Header.tsx | - | Private folder - no URL |
| src/app/.internal/page.tsx | - | Private folder - no URL |
Every folder becomes a URL segment. Add a page.tsx file to expose it.
Nest folders to create nested URL segments. Each nested folder adds one segment.
layout.tsx at the root wraps every page.Wrap a folder name in parentheses, like (marketing), to organize routes without adding a URL segment. The group name is dropped from the path.
Both pages are routed normally: /about and /cart. The group folders themselves never appear in the URL.
Each group can also have its own layout.tsx that wraps only the routes inside that group.
Prefix a folder with _ or . to keep it out of routing. Private folders do not create URLs. Use them to keep components, helpers, and data next to the route that uses them.
| Folder Pattern | Creates URL? | Description |
|---|---|---|
| _components | No | Private folder (underscore prefix) |
| .hidden | No | Private folder (dot prefix) |
| blog/_components | No | Private folder inside a route |
| about, blog | Yes | Public folder with page.tsx |
loading.tsx, not-found.tsx, and error.tsx use nearest-wins resolution. A file in a subfolder only affects that subfolder, and shadows the same file from a parent folder.
Resolution order: route's own folder → parent folders → built-in default.
Each folder type affects URLs differently. Static and nested folders create URL segments. Route groups and private folders do not.
| Folder Type | Example | Creates URL? |
|---|---|---|
| Static | src/app/about/page.tsx | Yes - /about |
| Nested | src/app/blog/authors/page.tsx | Yes - /blog/authors |
| Route group | src/app/(marketing)/about/page.tsx | Yes - /about (group dropped) |
| Private | src/app/_components/Header.tsx | No |
A folder-based project showing which folders create URLs and which do not.
| Folder Path | URL | Creates URL? |
|---|---|---|
| src/app/page.tsx | / | Yes |
| src/app/about/page.tsx | /about | Yes - static folder |
| src/app/blog/page.tsx | /blog | Yes - static folder |
| src/app/blog/authors/page.tsx | /blog/authors | Yes - nested folder |
| src/app/(marketing)/about/page.tsx | /about | Yes, group folder ignored |
| src/app/_components/Button.tsx | - | No - private folder |
| src/app/blog/_components/PostCard.tsx | - | No - private folder |
Define routes with flat files instead of folders.
Match URL segments with dynamic parameters and catch-alls.
Render multiple routes in the same layout with named slots.
Match any number of trailing URL segments.
Create your first pages and wrap them in shared layouts.
Learn how a Bini.js project is organized and what each folder contains.