Custom 404 UI with not-found.tsx - special file, no URL, nearest-wins.
Bini.js ships a built-in 404. Add not-found.tsx in any folder for custom UI when no route matches. It is a special file - it does not create a URL. Nearest-wins applies.
| File | Purpose |
|---|---|
| src/app/page.tsx | Home page |
| src/app/not-found.tsx | Global 404 fallback |
| src/app/blog/not-found.tsx | Blog-specific 404 |
Create not-found.tsx at the root of app/ to handle all unmatched routes.
/non-existent or /blog/invalid-post when no closer not-found exists.Place not-found.tsx in subdirectories for segment-specific 404 UI. The closest file to the unmatched path wins.
| URL | 404 Page Used |
|---|---|
| /blog/non-existent | src/app/blog/not-found.tsx |
| /admin/invalid | src/app/admin/not-found.tsx |
| /completely/wrong | src/app/not-found.tsx (global) |
When a route matches but data is missing, return your own not-found UI from the page component.
not-found.tsx is rendered inside the layout chain of the segment it belongs to. Headers and sidebars stay visible.
blog/not-found still shows the Blog header from blog/layout.Build any UI you want - copy, links, and actions are all client-side.
| File | Purpose |
|---|---|
| src/app/page.tsx | Home page |
| src/app/not-found.tsx | Global 404 |
| src/app/blog/not-found.tsx | Blog 404 |
| src/app/dashboard/not-found.tsx | Dashboard 404 |
Fallback for a parallel route slot with no match.
Control titles, descriptions, and social previews per route.
Catch render errors and show a fallback UI.
Wrap each page individually inside the layout chain.
Create your first pages and wrap them in shared layouts.
Define routes with folders and page files inside them.
Custom 404 UI with not-found.tsx - special file, no URL, nearest-wins.
Bini.js ships a built-in 404. Add not-found.tsx in any folder for custom UI when no route matches. It is a special file - it does not create a URL. Nearest-wins applies.
| File | Purpose |
|---|---|
| src/app/page.tsx | Home page |
| src/app/not-found.tsx | Global 404 fallback |
| src/app/blog/not-found.tsx | Blog-specific 404 |
Create not-found.tsx at the root of app/ to handle all unmatched routes.
/non-existent or /blog/invalid-post when no closer not-found exists.Place not-found.tsx in subdirectories for segment-specific 404 UI. The closest file to the unmatched path wins.
| URL | 404 Page Used |
|---|---|
| /blog/non-existent | src/app/blog/not-found.tsx |
| /admin/invalid | src/app/admin/not-found.tsx |
| /completely/wrong | src/app/not-found.tsx (global) |
When a route matches but data is missing, return your own not-found UI from the page component.
not-found.tsx is rendered inside the layout chain of the segment it belongs to. Headers and sidebars stay visible.
blog/not-found still shows the Blog header from blog/layout.Build any UI you want - copy, links, and actions are all client-side.
| File | Purpose |
|---|---|
| src/app/page.tsx | Home page |
| src/app/not-found.tsx | Global 404 |
| src/app/blog/not-found.tsx | Blog 404 |
| src/app/dashboard/not-found.tsx | Dashboard 404 |
Fallback for a parallel route slot with no match.
Control titles, descriptions, and social previews per route.
Catch render errors and show a fallback UI.
Wrap each page individually inside the layout chain.
Create your first pages and wrap them in shared layouts.
Define routes with folders and page files inside them.