Skip to main content
Headless4 min read

One Provider Switch, Two Commerce Backends: The VÉLTR Hydrogen Build

Portfolio build: a premium e-bike storefront backed by a real Shopify store, with a single provider boundary that can swap the live Storefront API for mock.shop without touching a UI component.

Driss OUDMINE
Driss OUDMINE
Shopify Theme & App Developer · hello@doudmine.com
One Provider Switch, Two Commerce Backends: The VÉLTR Hydrogen Build
Project preview — One Provider Switch, Two Commerce Backends: The VÉLTR Hydrogen Build
Project Links
Executive Summary & Key Architectural Rules
  • Lighthouse: 1.0 / 1.0 / 1.0 (from Accessibility · Best Practices · SEO)
  • Routes verified: 11 (from Zero console errors)
  • Commerce providers: 2 (from Shopify + mock.shop)
  • Products seeded: 5 (from Custom metafields)
  • Five VÉLTR products, three collections and custom specification metafields created in the live store.
  • GSAP owns hero/scroll/parallax effects and Motion owns UI transitions — no element is animated by both.
  • 11-route walk passed with zero console errors, including not-found and empty states.
  • Cloudflare Workers path validated with Wrangler dry run and a local workerd SSR/cart smoke test.
  • createCommerceServices() is the only place that chooses between the Shopify and mock.shop catalog/cart services.
  • Both providers share GraphQL documents and mappers, so UI components see identical normalized types.

Portfolio build: a premium e-bike storefront backed by a real Shopify store, with a single provider boundary that can swap the live Storefront API for mock.shop without touching a UI component.

Good architecture is what lets a storefront stay fast and editable as the catalog and the team behind it grow.

The challenge. The visual prototype had to become a genuinely commerce-backed storefront without coupling page components to a specific GraphQL shape. It also needed a credential-free demo path for reviewers, while keeping the live store’s cart secret out of every browser-facing payload.

The solution. Introduced a provider boundary in app/lib/commerce/services.server.ts that selects Shopify Storefront or mock.shop services for both catalog and cart. Route loaders return normalized Product, Collection and Cart types; a shared mapper translates GraphQL responses. Cart mutations use Hydrogen-compatible server services, and an HttpOnly cookie stores the cart ID while a public adapter replaces its secret key with the opaque id "current" before serialization.

Measured results. Lighthouse reached 1.0 / 1.0 / 1.0 from Accessibility · Best Practices · SEO; Routes verified reached 11 from Zero console errors; Commerce providers reached 2 from Shopify + mock.shop; Products seeded reached 5 from Custom metafields.

Scope of work. Shopify Storefront API integration with Admin GraphQL catalog seeding; Provider abstraction for live Shopify and mock.shop catalogs/carts; Cursor-based collection pagination and search; Server-side cart with HttpOnly session and hosted checkout handoff.

Architecture notes. createCommerceServices() is the only place that chooses between the Shopify and mock.shop catalog/cart services. Both providers share GraphQL documents and mappers, so UI components see identical normalized types. Collection and cart pagination use cursors; "Load more" was verified from 12 to 24 cards. Search uses QueryRoot.search because mock.shop silently ignores products(query:). The cart secret never appears in the DOM, action response or client bundle.

Highlights. Five VÉLTR products, three collections and custom specification metafields created in the live store.; GSAP owns hero/scroll/parallax effects and Motion owns UI transitions — no element is animated by both.; 11-route walk passed with zero console errors, including not-found and empty states.; Cloudflare Workers path validated with Wrangler dry run and a local workerd SSR/cart smoke test..

Shopify cart IDs contain a secret key component. The cart service keeps that ID in an HttpOnly cookie and the public adapter replaces it with an opaque "current" placeholder before any data reaches the React Router document or action response. Verified: no cart secret in the DOM, action body or client bundle.

Deployment note. Live Shopify Storefront API · credential-free mock.shop fallback

Project note. "Project note: VÉLTR was built as a portfolio storefront for a fictional brand. Its numbers are verification results from the build, not merchant sales data; checkout works against the live store, while mock.shop is kept as a credential-free demo fallback." — Driss OUDMINE, Portfolio build notes · headless commerce.

Built by Driss OUDMINE — Shopify Theme & App Developer.

Production-Ready Implementation

Source-level excerpts from the build.

Zero External Dependencies
app/lib/commerce/cart-public.ts
// The server-only cart ID is never serialized to the browser.
export function toClientCart(cart: Cart | null): Cart {
  if (!cart) return EMPTY_CART;
  const { id: _serverId, ...rest } = cart;
  return { ...rest, id: 'current' };
}

Pre-Deployment Safety Checklist for Shopify Merchants

1.Always duplicate your live theme to create a staging preview before editing Liquid snippets.
2.Test all checkout progression hooks with test credit card credentials in sandbox mode.
3.Audit your Core Web Vitals on Google PageSpeed Insights after deploying to verify 0 layout shifts.
Driss OUDMINE
Written by

Driss OUDMINE

Shopify Theme & App Developer specializing in Online Store 2.0 themes, custom Shopify apps, Shopify APIs (GraphQL/REST), and store speed optimization. Not available for new opportunities at this moment.

hello@doudmine.com
Previous Article
A Liquid Developer’s Path to a Headless Hydrogen Storefront
Next Article
A Production-Grade Hydrogen Storefront With a Real Shopify Catalog
Get in Touch · Full-Time Roles

Let's discuss how I can contribute to your team.

I am not available for new opportunities at this moment. You can still reach out for general questions about my work and articles.

Direct Email

hello@doudmine.com
One-click clipboard copy:

Candidate Snapshot:

Fast Response (Within 24 Hours)

I personally monitor my inbox and respond to technical recruiters and engineering managers promptly.

Work Authorization & Setup

Ready for remote full-time employment via Deel, Oyster, Remote.com, or direct employment.

Flexible Notice Period

Able to join team sprints within 1–2 weeks upon agreement.