
How We Moved a Production Shopify App Off Gadget, With Zero Stores Lost
AgentIQ and Autopilot started on Gadget, and Gadget got us to market fast. Then we needed what a managed platform can't give you: our own database and full control of our infrastructure. So we moved the whole app to Google Cloud, and no store was lost.
We turned everything we learned into an open-source Claude Code skill, migrating-off-gadget, so the next team doesn't have to rediscover it. This post is the short version.
The rule: change where the code runs, never what it does
The app's source stayed untouched. Instead of rewriting api/** and web/**, we gave it a stand-in for every Gadget package. Imports of gadget-server, gadget-server/shopify, the generated @gadget-client and @gadgetinc/react resolve through one alias map to our own modules. The same map is used by the bundler, the test runner and a Node --import resolve hook. One data engine sits behind both api.* on the server and the browser client, and tenancy lives in that engine, not at call sites.
That rule made the existing test suite our first parity check. If it passed against the stand-ins, the behaviour hadn't changed.
The plan we dropped
The obvious design is a per-model ladder: dual-write each model, shadow-read it, flip it, with an outbox and a reconciler. We designed it and threw it away. Gadget's database is closed (no change data capture, no replica), so per-model dual-write doubles every write path for months. Moving one store at a time needs only one bridge and one copy routine, and every store keeps a one-click way back.
The nine phases
Each phase leaves the app fully working and has an exit gate before the next starts.
- Inventory and prune. Count the Gadget surface actually used, drop unused models first, and add a ratchet test that caps direct Gadget calls at today's count.
- Landing zone in infrastructure as code: runtime, private Postgres with point-in-time recovery on, queues, cron, secrets and keyless CI deploys.
- Stand-ins by alias, with cross-shop tenancy tests and a load map proving every route file imports and answers.
- Schema and jobs. A generic engine driven by a registry parsed from
schema.gadget.ts; Gadget ids kept verbatim as primary keys; queue lanes and crons reproduced. - A bridge on the Gadget side: authenticated internal routes for the shop row, a Shopify GraphQL proxy, row export by
updatedSince, token hand-off and billing status. It is the only change capture there is. - Front door. The new app URL proxies every not-yet-moved store to Gadget unchanged, so the Shopify app URL can be repointed while it is a pure pass-through. New installs land on the new home.
- Store moves: warm copy (parents before children), count check, a write pause of a few seconds while the last delta lands, token hand-off, webhooks and sync on the new side, then flip the store's home flag.
- Waves. Small and free stores first, paying and big catalogs later, VIPs by hand. Concurrency around 6; pause on more than 3 failures or 10%.
- Decommission. Remove the proxy, kill-switch the bridge, delete the old webhook subscriptions, keep Gadget idle for about a week as a cold backup, then delete it.
The skill's traps.md lists the bugs a port like this runs into, as symptom → cause → fix, and the parity checks that catch them.
Red flags that mean stop
- Editing app code to make it run on the new home. Write a stand-in instead.
- Both sides renewing one store's Shopify token, or both running its jobs. One owner, always.
- Treating a store as moved because a row for it exists. Home is an explicit flag set by the move.
- Touching real merchant stores before your own test store round-trips in production.
- Deleting Gadget data before the decommission soak.
Use the skill
The skill works on GCP, AWS, Azure or any container-plus-Postgres host; providers.md maps each capability slot to each cloud. Install it in Claude Code:
/plugin marketplace add 40RTY-ai/gadget-migration
/plugin install gadget-migration@gadget-migrationThen start with the inventory, which counts the Gadget surface your repo uses:
skills/migrating-off-gadget/scripts/inventory.sh path/to/your-gadget-appThe source and docs are on GitHub, with a readable version on the project site. If you run Shopify stores rather than build apps, our Shopify Admin Skills are the other half of the toolkit: 116 skills and 21 scheduled routines for operating a store with an agent.