T
TanStack16mo ago
like-gold

How to work with tanstack router in a subdomain based app?

I've trie'd a many structures in my project but nothing works, multiple roots, multiple tsr.configs, multiple _layouts. I dont want to use the subdomain as path because i think that is a bad practice to use someting like: subdomain1.domain/subdomain1/login & subdomain2.domain/subdomain2/login In react-router-dom i just pass two diffrent router files for each subdomain, but in tanstack thats impossible.
3 Replies
like-gold
like-gold16mo ago
Can you elaborate?
like-gold
like-goldOP16mo ago
I'm looking for solutions to work with routes with the same path in different subdomains but that render different screens example: subdomain1.domain/login should be a diffrent screen of subdomain2.domain/login but in file-based route login will be the same file to both subdomains unless i create two routers. but i think that i can only have two routers in code-based, which in my opinion takes away the point of using the tanstack router in my project
stormy-gold
stormy-gold16mo ago
If its the glitterly UI stuff (like colors/theme), but the same application logic, then you could using the beforeLoad to check and modify your context. If its to do with any further deeper logic, you'll need to have two separate apps. You can use a monorepo to easy the component sharing, but its ought to be two different apps.

Did you find this page helpful?