Subdomain themes

Hey everyone, I'm trying to find the best solution for this use-case, basically I need multiple versions of my app, lets say 4, where each one of them are exactly the same with different theme/styles based on the subdomain Lets assume I need mars.whatever.com, saturn.whatever.com, etc. In order to conditionally style I have a different class on html body (the rest is using css vars and tailwind but its outside of the scope of this question) There's multiple approaches and I'm trying to find the best one without adding much overhead and keeping everything automated 1) Main branch deploys to prod, single vercel project - useEffect on _app to sync url with body class (check url subdomain and conditionally add the class) 2) Multiple vercel projects pointing to the same git repo, with a different environment variable, which would map to the body class and could be set during build on _document, better SSR and no flickers Any suggestions would be appreciated, not sure if I'm overthinking this. Thanks folks
1 Reply
Matvey
Matvey15mo ago
I think the first approach is better.
Want results from more Discord servers?
Add your server