Choosing Your Multistore Approach
Understanding when to use domain-based vs path-based routing is crucial for making the right architectural decision for your multistore project.
Approaches Overview
Domain-Based Routing (File-Based Inheritance)
Best for: Distinct brands, different target audiences, independent teams
Creates separate deployable instances for each store using file-based inheritance for shared functionality.
Path-Based Routing (Config Switcher)
Best for: Single brand with configuration variations, shared customer session
Uses a single deployment with dynamic configuration switching based on URL paths.
Mixed Routing
Best for: Complex scenarios requiring both brand separation and integration configuration variations
Combines domain-based routing for brands with path-based routing within specific stores.
Detailed Comparison
Domain-Based Routing (File-Based Inheritance)
Advantages:
- SEO Excellence: Each domain has independent SEO strategies, meta tags, sitemaps, and search indexing
- Simple Implementation: Override entire files rather than adding conditional logic - just replace
header.tsx
with your brand-specific version - Independent Scaling: Deploy and scale each store separately based on traffic and business needs
- Team Isolation: Different teams can work independently on their store overrides without conflicts
- Performance: No runtime conditional logic - everything is pre-built and optimized
- Clear Separation: Easy to understand what belongs to which store
- Independent Deployments: Deploy stores on different schedules without affecting others
Disadvantages:
- Development Overhead: Every store runs separately in development mode, creates separate build outputs, and deploys to separate Console projects
- File Override Granularity: To avoid code duplication, you may need to create hasty abstractions. For example, if you want to override just the checkout button in
ProductCard.tsx
, you must extract it into a separateCheckoutButton.tsx
component to avoid duplicating the entire ProductCard logic across stores. This fragments cohesive components into many small files, adding mental overhead when navigating the codebase
Path-Based Routing (Config Switcher)
Advantages:
- Shared User State: Users maintain cart, session within a store
- Dynamic Switching: Can switch configurations and content at runtime
Disadvantages:
- SEO Limitations: Harder to implement different SEO strategies for different paths (same domain, shared meta tags)
- Conditional Complexity: Requires conditional rendering, styling, and business logic throughout the codebase
- Runtime Overhead: Configuration switching logic executes on every request
- Shared Scaling: All configurations scale together - can't optimize for different traffic patterns
- Deployment Coupling: All configurations must deploy together, reducing deployment flexibility
- Team Coordination: All teams work on a single app, requiring coordination for shared file changes (vs domain-based where teams can independently override files like
ProductCard.tsx
without affecting others)
Decision Matrix
Factor | Domain-Based | Path-Based |
---|---|---|
Implementation Complexity | ✅ Simple - file overrides | ❌ Complex - conditional logic |
Iteration Speed | ❌ Slower - work on multiple Storefronts | ✅ Faster - single Storefront |
Team Independence | ✅ High - independent store overrides | ❌ Low - shared files require coordination |
Independent Scaling | ✅ Yes - per store | ❌ No - shared infrastructure |
Deployment Flexibility | ✅ Independent schedules | ❌ Coupled deployments |
Performance | ✅ Optimized - no runtime switching | ⚠️ Overhead - runtime decisions |
User Experience Continuity | ❌ Domain switches might break user flow | ✅ Seamless navigation between sections |
SEO Requirements | ✅ Excellent - independent strategies | ⚠️ Limited - shared domain constraints |
Quick Decision Guide
Default recommendation: Use domain-based routing (file-based inheritance) unless you have specific requirements that necessitate path-based routing.
Choose path-based routing only when you need:
- Multiple configurations on a single domain (SEO requirements, legal constraints)
- Shared user sessions across different sections
In most cases, domain-based routing provides better separation, easier maintenance, and simpler implementation.
Implementation Guides
Based on your decision:
- Domain-Based: Follow the multistore tooling and concepts guide
- Path-Based: Follow the sub-path routing implementation guide
- Mixed Approach: Follow the mixed routing guide