TanStackT
TanStack2y ago
20 replies
dead-brown

File System Routing: Multiple levels of nesting in a single directory

Hi, I have an application that for most urls has three levels of path params. Something like this:

myapp.com/project/$projectName/environment/$environmentName/build/$buildVersion/... the rest of the url here

Most of the application's pages go under this structure.

Is there a way to specify multiple levels of nesting in a single file system directory?

What I'd like is something like (where the : is equivalent to
/
in the url):

-- __root.tsx
-- project:$projectName:environment:$environmentName:build:$buildName
---- page1.tsx
---- page2.tsx

etc.

Currently, if I want to do this I am needing to create a bunch of nested folders and it gets kind of messy quickly. We need to include all this in the path so that it's human readable, and links can be shared between users etc.

Thanks!
Was this page helpful?