Store data in database vs Store data in theme file

DanielTehrani
Excursionist
42 1 5

 

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

  1. Merchant updates the badges' settings in the App's admin panel.
  2. Update theme according to the settings using the Asset API directly from the frontend(React).

Fetch badge settings

  1. When the App loads, get the theme file using the Asset API and retrieve the badges' settings from the Liquid code.
  2. Show settings in App's admin panel.

 

Pattern B

Update badge settings

  1. Merchant updates the badges' settings in the App's admin panel.
  2. Call the App's API PUT "/badge-settings".
  3. The API defined in the App triggers a call in the Asset API to update the theme file.

 

Fetch badge settings

  1. When the App loads, get the badges' settings using the App's API.
  2. Show settings in App's admin panel.

 

Appreciate if someone can point out which one is better or suggest a different pattern/idea.

 

Thanks.

 

 

0 Likes