Skip to content

Commit 0bb7ecc

Browse files
committed
docs: merge mutlsitore docs
1 parent 5d0e4de commit 0bb7ecc

File tree

1 file changed

+35
-2
lines changed
  • docs/content/guides/7.multistore/3.patterns/5.subpath

1 file changed

+35
-2
lines changed

Diff for: docs/content/guides/7.multistore/3.patterns/5.subpath/1.subpath.md

+35-2
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,47 @@ For example, with this setup you could have:
2424

2525
All of this is served from a single Frontend deployment.
2626

27-
## Setting Up the Middleware
27+
### How Config Switcher Works
2828

29-
The first step is to configure your Middleware to support different configurations using the Config Switcher extension.
29+
The Config Switcher dynamically changes your middleware integration configuration based on the current request configuration ID sent with the `x-alokai-middleware-config-id` header. This means:
30+
31+
1. **Path-Based Configuration**
32+
- Different configuration ID set by different paths allow to fetch data from different sources
33+
- Example: `/apparel` path shows apparel products, while `/electronics` shows electronics products
34+
35+
2. **Configuration ID vs Store ID**
36+
- Each configuration has its own distinct ID
37+
- This is different from the store ID (`storeId`)
38+
- Multiple configurations can exist within a single store
39+
40+
3. **Same-Store Operation**
41+
- Config Switcher works within a single store instance
42+
- It extracts the configuration ID from the request
43+
- It executes requests using the appropriate configuration
3044

3145
::tip Config Switcher Documentation
3246
This section provides a brief overview of setting up Config Switcher. For complete documentation, refer to the [Config Switcher guide](https://docs.alokai.com/middleware/guides/config-switcher).
3347
::
3448

49+
### Key Distinctions To File-Based Inheritance
50+
51+
`ConfigSwitcher` operates differently from file-based inheritance:
52+
53+
| **File-Based Inheritance** | **Config Switcher** |
54+
| --------------------------------------- | ---------------------------------------------------------------- |
55+
| Works **between different stores** | Works **within a single store** |
56+
| Creates separate deployable instances | Uses a single deployable instance |
57+
| Full codebase customization | Only middleware configuration changes, Storefront code is shared |
58+
| Requires separate builds for each store | Single build supports multiple configurations |
59+
60+
Take a look at the diagram to see the difference:
61+
62+
<img src="../../img/file-based-vs-switcher-diagram.png" alt="Comparison of File-based Inheritance vs Config Switcher" class="mx-auto">
63+
64+
## Setting Up the Middleware
65+
66+
The first step is to configure your Middleware to support different configurations using the Config Switcher extension.
67+
3568
Create a Config Switcher extension for your integration:
3669

3770
```ts

0 commit comments

Comments
 (0)