I’m working on an embedded Shopify App that displays badges on the store. Merchants should be able to update the setting of the badges from the App’s admin panel. I came up with two patterns to implement the functionality of my App. (Pattern A and Pattern B) I’m using the NodeJS + React tech stack.
Pattern A
Update badge settings
- Merchant updates the badges’ settings in the App’s admin panel.
- Update theme according to the settings using the Asset API directly from the frontend(React).
Fetch badge settings
- When the App loads, get the theme file using the Asset API and retrieve the badges’ settings from the Liquid code.
- Show settings in App’s admin panel.
Pattern B
Update badge settings
- Merchant updates the badges’ settings in the App’s admin panel.
- Call the App’s API PUT “/badge-settings”.
- The API defined in the App triggers a call in the Asset API to update the theme file.
Fetch badge settings
- When the App loads, get the badges’ settings using the App’s API.
- Show settings in App’s admin panel.
Appreciate if someone can point out which one is better or suggest a different pattern/idea.
Thanks.