Routing
File-based TanStack Router routes, grouped by audience, with guards in layout routes.
Routes live in src/routes. Folders in parentheses are pathless groups: they add a
layout without adding a URL segment.
| URL | File | Notes |
|---|---|---|
/ | index.tsx | Redirects to /dashboard (public marketing lives in apps/main-web) |
/sign-in | sign-in/index.tsx | Redirects to /dashboard with a session |
/auth/callback | auth/callback.tsx | Magic-link and Google sign-in landing |
/onboarding | onboarding/index.tsx | First-run wizard |
/dashboard | (dashboard)/dashboard/index.tsx | Workspace overview |
/drive, /shared, /recent, /starred | (dashboard)/*/index.tsx | Views over the merged drive |
/storage | (dashboard)/storage/index.tsx | Connected storage accounts |
/settings | (dashboard)/settings/index.tsx | Tabs via ?tab=: storage, s3, account, organizations, workspaces |
/organizations/$orgId | (dashboard)/organizations/$orgId.tsx | Organization detail |
/workspaces/$wsId | (dashboard)/workspaces/$wsId.tsx | Workspace detail |
/organizations, /workspaces, /providers, /s3 | (dashboard)/*/index.tsx | Redirects into the matching settings tab |
/preview | preview/index.tsx | Dev-only mock dashboard (404 in production) |
Layout routes
(marketing)/route.tsxwraps the public pages in<div className="marketing">, which switches to the marketing palette and font (see Styling).(dashboard)/route.tsxrendersDashboardGate(components/block/auth/dashboard-gate.tsx):- no session →
/sign-in; - a session but no organization →
/onboarding; - otherwise the sidebar shell with the page inside.
- no session →
__root.tsxmounts the providers (theme, nuqs, tooltips), the toaster,<HeadContent />for per-route titles, and the 404/error pages. Devtools load only in development.
Titles and meta
Static defaults (title, description, Open Graph, Twitter cards) are in index.html,
because crawlers do not run the SPA. A route sets its own title through head:
export const Route = createFileRoute('/(dashboard)/storage/')({
head: () => ({ meta: [{ title: 'Storage Accounts | Cloudrive' }] }),
component: StorageContent,
})Links that carry search params
Most dashboard links keep the active organization and workspace in ?org= and ?ws=.
TanStack Router matches to as a path only, so never put a query string in to:
// static: pass search explicitly
<Link to="/settings" search={{ tab: 'workspaces' }}>Workspaces</Link>
// built URLs (scoped hrefs): split them with hrefToLocation
<Link {...hrefToLocation(scopedHref('/storage'))}>Storage</Link>
void navigate(hrefToLocation('/storage?org=…&ws=…'))hrefToLocation lives in lib/utils.ts. The settings route declares validateSearch for
tab and view so typed navigate({ to: '/settings', search: { tab } }) compiles.