Skip to content

Conversation

@Kashuab
Copy link

@Kashuab Kashuab commented Nov 9, 2025

Disclaimer: This is a draft PR, still some more work to do :) Please feel free to take a look though!

Related issues #2, #7, #5, #4, #3


Hey! I finally got some time to sink my teeth into this. 😄

This PR has a lot of changes, and will probably get more as I continue to flesh out modals. My goals were:

  • Get the "Shopify admin" wrapper to look more like Shopify
  • Separate some concerns, "server", "app bridge" and "admin frame" should be separate things (in my opinion!)
  • Create a more scalable, type-safe mechanism for postMessage comms between the admin frame and client app bridge
  • Work out of box with Shopify app remix template (and I guess React Router now? 😛)

In doing so, I've introduced a plethora of changes:

  • Created new directory containing a Vite SPA for the admin frame
  • Polaris web components worked OOB after I added their script :)
  • Created new directory containing the client app bridge source (now in TypeScript + build scripts!)
  • Fixed a bug where the default value for --shop would override the shop I have set in config
  • Accept a user ID which is encoded into session tokens (TODO: needs CLI arg)
  • Add session token to initial iframe src via id_token param, my Remix app needed this
  • Implemented a system where you can define "features" as Zustand stores (see Modal feature)
  • Started work on modals (Works actually!)
  • Added boilerplate features on window.shopify definition, give those a place to live for future iteration
  • Added docs for Remix integration

PLEASE ask me all the questions and give any feedback (maybe aside from code review, it's unfinished!) Let me know if this is in-line with your vision or if there is some contribution etiquette I'm missing!

So much more TODO, including adding more info to this description. It's Saturday evening and I'm craving some brew 🍺

Remaining tasks in this PR:

  • Improve wrapper UI to match Shopify admin (currently is just a Polaris web components proof of concept)
  • Finish up modals feature (ensure MutationObserver works properly, modal content should be dynamic, unmounting should invoke cleanup, etc.)
  • invokeFeature is fine for unidirectional/opaque flow (app iframe -> parent) but what if the parent wants to return data? 🤔
  • Document "features" for future contributors. We'll need some help reverse engineering app-bridge, let alone keeping it up-to-date 😅
  • Ensure no/minimal breaking changes (don't want to break your stuff!)
  • Clean up code
  • Tests...? Too early to invest in? 🤷

</div>

<div
className="main-content"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish I could just use <Frame /> from Polaris React 😭

/**
* Print configuration summary
*/
function printConfigSummary(config: MockShopifyAdminConfig): void {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that this print ended up being inaccurate when my config file was applied

.argument('[app-url]', 'Your app\'s URL (e.g., http://localhost:3000/shopify)')
.option('-i, --client-id <id>', 'Your Shopify app\'s client ID (optional, defaults to development ID)')
.option('-s, --client-secret <secret>', 'Mock client secret (development only)')
.option('--shop <domain>', 'Mock shop domain', 'test-shop.myshopify.com')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's probably a better way, but this default was overriding my config

@Kashuab
Copy link
Author

Kashuab commented Nov 10, 2025

Now that I think about it, a better way to handle modal lifecycle would be to implement web components for them :P

@Zn4rK
Copy link

Zn4rK commented Nov 20, 2025

Is there any chance we'll get this in? This is like the missing link in Shopify App Development :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants