Back to Work
Backend Architecture2026

Store Bridge

tRPCNode.jsStorefront APIAdmin APIEdge

A Backend-for-Frontend layer that unifies Shopify's Storefront and Admin APIs behind a single, type-safe tRPC interface — reducing client complexity and enabling edge caching.

The Challenge

Headless Shopify storefronts need data from multiple Shopify APIs: product data from Storefront API, inventory from Admin API, metafields from both, and custom logic for pricing rules. Frontend code becomes a tangled web of different API clients, authentication schemes, and error handling patterns.

The Solution

Built a tRPC-based BFF that sits between the frontend and Shopify. It merges data from multiple Shopify APIs into unified response shapes, handles all authentication, implements edge caching strategies, and exposes a single type-safe interface that frontends consume.

Design
Code
Result
src/routers/product.tstypescript
  1export const productRouter = router({  2  getByHandle: publicProcedure  3    .input(z.object({ handle: z.string() }))  4    .query(async ({ input, ctx }) => {  5      // Parallel fetch from both APIs  6      const [storefrontData, adminData] = await Promise.all([  7        ctx.storefront.query(PRODUCT_QUERY, {  8          variables: { handle: input.handle },  9        }), 10        ctx.admin.query(INVENTORY_QUERY, { 11          variables: { handle: input.handle }, 12        }), 13      ]) 14 15      const product = storefrontData.product 16      const inventory = adminData.productByHandle 17 18      return { 19        ...product, 20        variants: product.variants.nodes.map(variant => ({ 21          ...variant, 22          inventoryQuantity: inventory?.variants.nodes 23            .find(v => v.id === variant.id) 24            ?.inventoryQuantity ?? null, 25          // Custom pricing logic 26          finalPrice: applyPricingRules(variant, ctx.customerTags), 27        })), 28      } 29    }), 30}) 31
Scroll to explore
Tech Stack
tRPCNode.jsHonoCloudflare WorkersShopify Storefront APIShopify Admin APITypeScriptZod

Interested in similar work?

Let's discuss how I can help bring your Shopify project to life.