Hey Team!I am trying to build order editing app for Shopify, but gadgets model > action and global.

One major concern is that we have to keep global actions flat. api/ ├── actions/ # Global Actions (must stay flat) │ ├── addItem.js │ ├── beginEdit.js │ ├── commitEdit.js │ ├── changeQuantity.js .... ... utilities/ # Helper and domain level code -- orderEditSession.js -- rulesValidator.js -- upsellEngine.js This pattern would eventually result in a large file under the action folder. Is there a better way of architecting the file? I am in a dilemma about whether I should continue using gadgets. Could you please help me understading the proper folder structure in gadgets
2 Replies
Chocci_Milk
Chocci_Milk2w ago
Global actions folders don't need to be flat. You can create whats called namespaced actions which means an action path of api/actions/namespace/someAction.ts would be called with api.namespace.someAction(). Utils folders can't be in the routes, actions, or model folders since those folders handle files/folders in a particular way Have you taken a look at these docs? https://docs.gadget.dev/guides/actions/namespacing-global-actions
Genius Cloud
Genius CloudOP2w ago
Alright! I will give it a try and let you know if I come up with more questions. Thanks, Antonie!

Did you find this page helpful?