Skip to main content

Adding New Pages

BunShip Pro uses TanStack Router with file-based routing. Create a file and you have a route.

How Routing Works

Routes live in apps/web/src/routes/. The file name becomes the URL path:

Layout Groups

Files are organized into layout groups using the underscore prefix: The layout file (e.g., _app.tsx) wraps all pages in that group with shared UI — sidebar, header, auth protection.

Adding a Dashboard Page

  1. Create a file in routes/_app/:
  1. The page is now accessible at /analytics (authentication required automatically via the _app layout).

Adding an Organization Page

Organization pages are scoped to a specific org and have access to the org ID from the URL:
This page is available at /organizations/:orgId/reports.

Adding to the Sidebar

The sidebar navigation is defined in apps/web/src/components/sidebar.tsx. There are two navigation arrays: Add items to the DEFAULT_SECTIONS array:

Organization Navigation

Add items to the ALL_ORG_ITEMS array. Each item belongs to either the org section (user-facing) or dev section (developer tools):
Import icons from lucide-react.

Protecting Pages by Role

The organization layout provides role context. Use the useOrgContext() hook to check the current user’s role:

Role Hierarchy

Roles are hierarchical: owner > admin > member > viewer. Permissions are defined in packages/config/src/features.ts:

Adding a Marketing Page

Marketing pages use the _marketing layout with the public header and footer:
To add it to the marketing header navigation, edit apps/web/src/components/marketing-header.tsx.

Next Steps