I'm designing a web application. I'd like to use sub-domains to split the site into logic separate sections based on some category - exactly like the stack exchange websites do. I'm currently aware of two approaches to this ...
- One large application that gathers context from the current domain (or some other way) and renders X or Y template based on the sub-domain. I view this as a lot of run-time logic that selectively renders the correct items based on the current sub-domain.
- Multiple application "builds" that are each individually hard-coded for their sub-domain, but still likely re-use a lot of shared code from the other sub-domains.
My web application is written using JS and React, and I bundle it using webpack. The approach for each of these scenarios seems straight forward in terms of how I get from here to there.
My question is, based on the stack exchange example and my description, which approach is "better"? Does either one have any gotchas that would be nice to know? I'm currently leaning towards the individual static builds per each sub-domain, because that seems pretty intuitive and easy to maintain.