{
  "slug": "shopify-admin-api-frontend-proxy",
  "title": "Call Shopify Admin API from Frontend Store Securely",
  "metaTitle": "Call Shopify Admin API from - RealComposer",
  "metaDescription": "Call shopify admin api from frontend store securely. Keep Shopify keys in RealComposer Vault; Frontend / Web uses rc_live_ tokens only.",
  "headline": "Shopify secrets stay out of Frontend / Web bundles",
  "category": "security",
  "categoryLabel": "Security & Secret Vault",
  "urgency": 9,
  "clientPlatform": "Frontend / Web",
  "upstreamServices": [
    "Shopify"
  ],
  "searchIntentQuery": "call shopify admin api from frontend store securely",
  "directAnswerSummary": "Frontend / Web cannot safely store Shopify production keys. Vault-bound headers reach https://{{secrets.SHOPIFY_STORE}}.myshopify.com/admin/api/2026-10/products.json?limit=5 on Workers while apps call your shopify-admin-api-frontend-proxy edge URL.",
  "problem": {
    "title": "Why Frontend / Web leaks Shopify credentials",
    "explanation": "Attackers routinely extract Shopify secrets from Frontend / Web builds. Direct browser calls also expose internal error payloads with hostnames.",
    "risks": [
      "Production Shopify keys copied from Frontend / Web bundles",
      "Compliance violations after credential leaks",
      "Attackers replaying vault-grade scopes from a laptop"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Add vault secrets for this pipeline",
      "description": "Add SHOPIFY_ACCESS_TOKEN to RealComposer Secret Vault. Values decrypt only inside the Cloudflare Worker that calls the upstream."
    },
    {
      "stepNumber": 2,
      "title": "Target the real upstream URL",
      "description": "Point step shopify at https://{{secrets.SHOPIFY_STORE}}.myshopify.com/admin/api/2026-10/products.json?limit=5 with GET. Add output mapping fields that mirror the JSON contract your screen already expects. Leave cache TTL at 0 when each response is user-specific (include userId or record id in query params before enabling cache)."
    },
    {
      "stepNumber": 3,
      "title": "Call from Frontend / Web",
      "description": "Allowed origins on the token should list every Frontend / Web host that calls this URL.",
      "codeSnippet": "const res = await fetch('https://realcomposer.com/v1/workspace/shopify-admin-api-frontend-proxy', {\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});"
    }
  ],
  "pipelineConfig": {
    "name": "Call Shopify Admin API from Frontend Store Securely",
    "method": "GET",
    "cacheTtlSeconds": 0,
    "authMode": "client_token",
    "steps": [
      {
        "stepKey": "shopify",
        "upstreamUrlTemplate": "https://{{secrets.SHOPIFY_STORE}}.myshopify.com/admin/api/2026-10/products.json?limit=5",
        "httpMethod": "GET",
        "headersTemplate": {
          "X-Shopify-Access-Token": "{{secrets.SHOPIFY_ACCESS_TOKEN}}"
        },
        "timeoutMs": 3000
      }
    ],
    "outputMapping": {
      "version": 1,
      "fields": [
        {
          "targetPath": "productId",
          "sourcePath": "products.0.id",
          "type": "number",
          "sourceStep": "shopify"
        },
        {
          "targetPath": "title",
          "sourcePath": "products.0.title",
          "type": "string",
          "sourceStep": "shopify"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "requestId": "req_shopify-",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "shopify-admin-api-frontend-proxy"
    },
    "payload": {
      "id": "sample_id",
      "status": "active",
      "nested": {
        "tags": [
          "demo"
        ],
        "internal": true
      },
      "unused_blob": {
        "foo": "bar",
        "bar": "baz"
      }
    }
  },
  "sampleSlimmedOutput": {
    "productId": "sample",
    "title": "sample"
  },
  "curlSnippet": "curl -X GET \"https://realcomposer.com/v1/workspace/shopify-admin-api-frontend-proxy\" \\\n  -H \"Authorization: Bearer rc_live_client_token\"",
  "faqs": [
    {
      "question": "Which Shopify credential belongs in the vault for this pipeline?",
      "answer": "Point Frontend / Web at /recipes/shopify-admin-api-frontend-proxy edge URL. RealComposer answers OPTIONS with Access-Control headers for allowed origins."
    },
    {
      "question": "Does POST traffic get cached?",
      "answer": "Cache key for shopify-admin-api-frontend-proxy: internal edge-cache path plus sorted query. Identical params hit; vary userId per user."
    },
    {
      "question": "What happens if an upstream step times out?",
      "answer": "Rotate vault secrets for shopify-admin-api-frontend-proxy anytime; clients keep the same rc_live_ token."
    }
  ],
  "relatedRecipeSlugs": [
    "lightweight-api-gateway-jamstack",
    "github-api-private-token-proxy",
    "cache-airtable-avoid-rate-limits"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/shopify-admin-api-frontend-proxy",
    "markdown": "https://realcomposer.com/recipes/shopify-admin-api-frontend-proxy.md",
    "json": "https://realcomposer.com/recipes/shopify-admin-api-frontend-proxy.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=shopify-admin-api-frontend-proxy&via=agent"
  }
}