You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a production-ready Shopify source plugin for Universal Data Layer that enables developers to source all products from their Shopify stores into the UDL node store. This plugin will follow the established patterns from the Contentful plugin, providing seamless GraphQL querying of Shopify product data with full type safety and reference resolution.
The Shopify plugin will be the second major source plugin for UDL, validating our plugin architecture's flexibility and establishing patterns for e-commerce data sourcing. This enables developers building headless Shopify storefronts to leverage UDL's powerful GraphQL layer, caching, and codegen capabilities.
Background & Context
Current State: UDL has a mature Contentful source plugin that demonstrates the full plugin lifecycle: configuration, data fetching, node transformation, and reference resolution. The core plugin infrastructure supports custom indexes, reference resolvers (\$entries/\$ref pattern), and type generation.
Problem: Developers building headless Shopify stores currently need to either use Shopify's Storefront API directly or build custom integration layers. There's no standardized way to unify Shopify product data with other data sources in a type-safe GraphQL layer.
Opportunity: By creating a Shopify source plugin, we enable:
Unified GraphQL queries across Shopify products and other data sources
Type-safe queries with full codegen support
Caching and performance optimizations through UDL's node store
Reference resolution between Shopify entities (products ↔ collections ↔ variants)
Consistent developer experience across content sources
Goals & Success Metrics
Primary Goals
Source all products, variants, collections, and images from Shopify into UDL
Provide full reference resolution between Shopify entities using the existing \$entries/\$ref patterns
Generate accurate TypeScript types for all Shopify node types
Follow established Contentful plugin patterns for consistency
Success Metrics
All Shopify products sync correctly with variants, images, and metafields
Collections are sourced with product references properly linked
Generated types provide full autocomplete for Shopify fields
Test coverage: 100% for core functionality
Example project working with real Shopify store
Technical Strategy
Architecture Overview
The plugin will follow the established Contentful plugin patterns:
Configuration: Export config, onLoad, sourceNodes, referenceResolver, entityKeyConfig from udl.config.ts
Authentication: Use Shopify Storefront Access Token (or Admin API token for full data)
Data Fetching: GraphQL queries with cursor-based pagination
Transformation: Convert Shopify objects to UDL nodes with shopifyId index
Reference Resolution: Use marker field pattern (_shopifyRef) with existing core \$entries/\$ref infrastructure
Sync Strategy: Tiered approach with Bulk Operations API + Delta sync (see Sync Strategy section)
Key Design Decisions
API Choice: Storefront API vs Admin API
Decision: Start with Storefront API for public product data
Rationale: Storefront API is public-facing, has simpler auth, and covers most product sourcing needs. Admin API can be added later for inventory/order data.
Node Types Structure
Products → ShopifyProduct
Variants → ShopifyProductVariant
Collections → ShopifyCollection
Images → embedded in product nodes (not separate)
Data Layer Implications
Plugin Architecture: Follows established patterns - validates plugin architecture flexibility
Caching Strategy: Nodes cached by shopifyId with content digest for change detection
Framework Adapters: No changes needed - works with existing Next.js/Vite adapters
Reference Resolution: Uses existing core \$entries/\$ref infrastructure with shopifyId index
Implement a tiered sync strategy for Shopify data (products, collections, assets) that balances efficiency with freshness. Uses Bulk Operations API for initial/stale syncs and incremental queries for recent changes.
Goal: Set up plugin structure and basic authentication
Issue 1.1: Plugin Scaffold and Configuration
Description: Create the plugin package structure following Contentful plugin patterns. Set up TypeScript configuration, exports, and basic plugin lifecycle hooks.
Deliverables:
packages/plugin-source-shopify/ package structure
udl.config.ts with config, onLoad, sourceNodes, referenceResolver, entityKeyConfig exports
Options interface with required fields (storeDomain, storefrontAccessToken)
Options validation in onLoad
Error classes for Shopify-specific errors
Package.json with peer dependencies
Unit tests for options validation
Dependencies: None
Issue 1.2: Shopify GraphQL Client and Authentication
Description: Create a GraphQL client for Shopify Storefront API with proper authentication, error handling, and retry logic.
Deliverables:
GraphQL client wrapper with Storefront Access Token auth
[Epic]: Shopify Source Plugin - Product Sourcing
Vision Statement
Create a production-ready Shopify source plugin for Universal Data Layer that enables developers to source all products from their Shopify stores into the UDL node store. This plugin will follow the established patterns from the Contentful plugin, providing seamless GraphQL querying of Shopify product data with full type safety and reference resolution.
The Shopify plugin will be the second major source plugin for UDL, validating our plugin architecture's flexibility and establishing patterns for e-commerce data sourcing. This enables developers building headless Shopify storefronts to leverage UDL's powerful GraphQL layer, caching, and codegen capabilities.
Background & Context
Current State: UDL has a mature Contentful source plugin that demonstrates the full plugin lifecycle: configuration, data fetching, node transformation, and reference resolution. The core plugin infrastructure supports custom indexes, reference resolvers (
\$entries/\$refpattern), and type generation.Problem: Developers building headless Shopify stores currently need to either use Shopify's Storefront API directly or build custom integration layers. There's no standardized way to unify Shopify product data with other data sources in a type-safe GraphQL layer.
Opportunity: By creating a Shopify source plugin, we enable:
Goals & Success Metrics
Primary Goals
\$entries/\$refpatternsSuccess Metrics
Technical Strategy
Architecture Overview
The plugin will follow the established Contentful plugin patterns:
config,onLoad,sourceNodes,referenceResolver,entityKeyConfigfromudl.config.tsshopifyIdindex_shopifyRef) with existing core\$entries/\$refinfrastructureKey Design Decisions
API Choice: Storefront API vs Admin API
Node Types Structure
ShopifyProductShopifyProductVariantShopifyCollectionData Layer Implications
shopifyIdwith content digest for change detection\$entries/\$refinfrastructure withshopifyIdindexSync Strategy
Overview
Implement a tiered sync strategy for Shopify data (products, collections, assets) that balances efficiency with freshness. Uses Bulk Operations API for initial/stale syncs and incremental queries for recent changes.
Architecture Diagram
Sync Decision Logic
.udl-cache/shopifyexistslastSync> 30 dayslastSync≤ 30 daysComponents
Full Sync (Bulk Operations API)
bulkOperationRunQuerymutationcurrentBulkOperationquery)__parentId)Delta Sync
updated_at:>'${lastSync}'filter@shopify/shopify-apifor automatic rate limit handlingDeletion Handling
Remote UDL Integration
products/update,products/delete, etc.)Cache Structure
Implementation Roadmap
Phase 1: Foundation
Goal: Set up plugin structure and basic authentication
Issue 1.1: Plugin Scaffold and Configuration
packages/plugin-source-shopify/package structureudl.config.tswithconfig,onLoad,sourceNodes,referenceResolver,entityKeyConfigexportsonLoadIssue 1.2: Shopify GraphQL Client and Authentication
Phase 2: Core Data Sourcing
Goal: Implement product, variant, and collection sourcing
Issue 2.1: Product Fetching and Transformation
ShopifyProductnodesshopifyIdfield for reference resolutionIssue 2.2: Variant and Image Sourcing
_shopifyRefmarkerIssue 2.3: Collection Sourcing with Product References
ShopifyCollectionnodes_shopifyRefmarkerPhase 2.5: Shopify Sync
Goal: Implement efficient sync strategy for Shopify data
Issue 2.5.1: Shopify Bulk Operations Integration
bulkOperationRunQuerymutation for products, collections, files__parentIdrelationships)Issue 2.5.2: Shopify Delta Sync
updated_atfiltering for incremental updatesupdated_at:>'${lastSync}'filter@shopify/shopify-apiclientIssue 2.5.3: Shopify Webhook Handler
products/*,collections/*,inventory_levels/*WebhookHandlerinterfacePhase 3: Production Readiness
Goal: Documentation and example integration
Issue 3.1: Documentation and Example
docs/content/(similar to Contentful docs)examples/nextjs-shopify/or extend existing exampleRisks & Mitigation
Technical Risks
Dependencies
Testing Strategy
Test Coverage Goals
Test Approach
Documentation Requirements
Definition of Done
Future Considerations
This epic enables future enhancements:
Related Work
Issue Summary