Shopify Hydrogen Hosting: A Comprehensive Guide

Wed Jun 26 2024 - Yena Lam

Shopify Hydrogen Hosting: A Comprehensive Guide

Table of content

  • I. What is Hosting?
  • II. Hosting Options for Shopify Hydrogen
  • 2.1. How to deploy Shopify hydrogen to Oxygen
  • 2.2. How to deploy Shopify Hydrogen to Vercel
  • 2.3. How to deploy Shopify hydrogen to Netlify
  • 2.4. How to deploy Shopify hydrogen to Fly.io
  • 2.5. How to deploy to Cloudfare Workers
  • III. Aspects to consider which hosting is the best suit for your Shopify hydrogen?

In the dynamic world of e-commerce, Shopify Hydrogen has emerged as a game-changer. This React-based framework empowers developers to create custom, high-performance storefronts with ease. However, choosing the right hosting platform for your Hydrogen project is crucial to ensure optimal performance, scalability, and reliability. This article explores various hosting options and provides step-by-step guides for deploying your Shopify Hydrogen storefront to each platform.

I. What is Hosting?

Hosting or web hosting is a data storage space divided from servers, helping to upload data and publish websites and apps on the Internet. When you sign up for a hosting service, you are renting a space to store all the necessary files and data on the server so that the website can operate 24/7. Many developers and businesses prefer different hosting solutions based on their needs. Shopify developers, in particular, look for hosting that seamlessly integraes with Hydrogen, offers scalability, and ensures high performance.

II. Hosting Options for Shopify Hydrogen

A variety of hosting solutions are chosen by developers and businesses depending on what they need. For instance, Shopify developers seek a hosting solution that integrates with Hydrogen in a way that is seamless, is scalable, and offers high performance. Developers who use Shopify Hydrogen are provided with the necessary tools to build individual fast-loading storefronts according to their specific business needs: this ensures that the store performs optimally and customers have an easy time shopping at the store. So, to deploy Shopify Hydrogen, you can use hosting providers such as: Oxygen, Vercel, Netlify, Fly.io, Cloudflare.

2.1. How to deploy Shopify hydrogen to Oxygen

Oxygen is Shopify’s platform for hosting Hydrogen storefronts. It offers seamless integration, optimized performance, and an easy deployment process. Here’s how to deploy Shopify Hydrogen to Oxygen:

Step 1: Install the Hydrogen App

  • Visit Sales Channels in your Shopify admin.
  • Choose the dropdown “>”, select "All recommended sales channels.
  • Click “Hydrogen” under “Build custom storefronts."
  • Click"Install".

Step 2: Create Hydrogen Storefront

  • In your Shopify admin, Click “Hydrogen”.
  • Click “Create storefront”.
  • Choose "Connect existing repository”.
  • Select your GitHub account and Hydrogen app repository.
  • Click "Continue" and follow any further prompts.

Step 3: Configure Deployment Workflow

  • Oxygen uses a GitHub Action for deployments, typically found in the .github/workflows/oxygen.yml file in your repository.
  • Ensure its settings in the workflow, file match your needs, including environment variables and deployment paths.

Step 4: Deploy and Preview

  • Push changes to the main branch of your GitHub repository.
  • Oxygen automatically deploys your app and generates a preview URL.
  • Use the preview URL to test and your changes before merging to production.

Step 5: Merge to Production

  • Create a pull request and merge it to the main branch after thoroughly testing your work.
  • Oxygen automatically deploys the merged version to your live store.
  • These steps outline the process for deploying a Shopify Hydrogen store using Shopify Oxygen, ensuring a seamless integration and deployment experience.

Read more:

Oxygen hosting cost

It is available to merchants on the Basic, Shopify, Advanced and Shopify Plus plan. Unlike other hosting solutions, such as Vercel or Netlify, Oxygen does not incur additional costs for the hosting itself, bandwidth or storage usage. The hosting price is already included in the Shopify plan.

2.2. How to deploy Shopify Hydrogen to Vercel

Vercel is a cloud platform for static sites and serverless functions. It allows developers to build and deploy web projects with ease. With Vercel, you can deploy your project to the cloud and get a global CDN, custom domains, and automatic HTTPS. Here’s how to deploy Shopify Hydrogen to Vercle:

Step 1: Prepare Project

  • In root folder, rename server.ts to server-dev.ts for development purpose
  • Create a new server.ts file

Step 2: Update Configuration

  • Update remix.config.ts

Step 3: Modify Environment Variables

  • Update the remix.env.d.ts

Step 4: Update Session Settings

  • Update app/lib/session.server.ts

Step 5: Deploy to Vercel

  • Create a new project on Vercel and link it to your Hydrogen repository.
  • Define the build commands and settings in the Vercel dashboard.
  • Push changes to your repository, triggering Vercel’s build and deploy process.

Read more:

Vercel hosting cost

Offers a free tier with basic features, and premium plans start at $20/month, scaling with usage and advanced features.

Screenshot 2024-06-26 at 10.36.53.png

2.3. How to deploy Shopify hydrogen to Netlify

Netlify is widely preferred to deploy the most recent web applications mainly because of its simplicity, continuous deployment and the fact that it comes with a global content delivery network (CDN). Here’s how to deploy Shopify Hydrogen to Netlify:

Step 1: Set Up the Project

  • Clone the Hydrogen Netlify starter repositor: https://github.com/netlify/hydrogen-netlify-starter
  • Navigate to the repository folder: cd hydrogen-netlify-starter
  • Edit hydrogen.config.js and replace the storeDomain and storefrontToken with your Shopify store’s domain and Storefront API token.

Step 2: : Install Dependencies

  • Install the package : Screenshot 2024-06-26 at 11.52.29.png

Step 3: Run the Development Server

  • Start the application: Screenshot 2024-06-26 at 11.52.35.png

Step 4: Build for Production

Screenshot 2024-06-26 at 11.52.45.png

Step 5: Preview the Production Build

  • Build your Hydrogen app: Screenshot 2024-06-26 at 11.52.41.png

  • Run the preview command: Screenshot 2024-06-26 at 11.52.51.png

Netlity hosting cost Free tier available, with Pro plans starting at $19/month.

Screenshot 2024-06-26 at 10.29.23.png

2.4. How to deploy Shopify hydrogen to Fly.io

Fly.io is a new, developer-focus public cloud, easy to deploy on, power to grow on. It offers powerful and scalable hosting solutions with a focus on global deployment and edge computing.

Here’s how to deploy Shopify Hydrogen to Fly.io:

Step 1: Install Fly CLI

  • Install "flyctl" and sign up for Fly.io

Step 2: Set up the project

  • Navigate to your app directory: Screenshot 2024-06-26 at 17.59.11.png

  • Run the following command to create a new app in Fly.io and create a fly.toml file: Screenshot 2024-06-26 at 17.59.16.png Step 3: Configure Fly.io

  • From your project root, open fly.toml.

  • In the [env] section, add the following environment variables, using the format = "": Screenshot 2024-06-26 at 17.59.23.png

  • In the [http_service] section, change the value of internal_port. This value needs to match the PORT value. Screenshot 2024-06-26 at 17.59.31.png Step 4: Set environment secrets

    Screenshot 2024-06-26 at 17.59.39.png Step 5: Deploy to Fly.io

    Screenshot 2024-06-26 at 17.59.48.png

Fly.io hosting cost

Offers a pay-as-you-go model with costs depending on the resources used, typically starting at $5/month.

2.5. How to deploy to Cloudfare Workers

Cloudflare Workers are a platform for enabling serverless functions to run as close as possible to the end user. In essence, the serverless code itself is 'cached' on the network, and runs when it receives the right type of request. Cloudflare Workers code is hosted in Cloudflare's vast network of data centers around the world. Here’s how to deploy Shopify Hydrogen to Cloudfare Workers:

Step 1: Create a Hydrogen Project

Screenshot 2024-06-26 at 18.08.53.png

Step 2: Create wrangler.toml

  • Create wrangler.toml File.
  • Replace account_id, name, and route with your Cloudflare account ID, project name, and route, respectively.

Step 3: Install Cloudflare KV asset handler

Screenshot 2024-06-26 at 18.09.06.png

Step 4: Create a new Worker entry file

  • Create worker.js

Step 5: Update package.json

Screenshot 2024-06-26 at 18.09.13.png

Step 6: Deploy with Wrangler

Screenshot 2024-06-26 at 18.09.19.png

Cloudflare hosting cost

Workers AI is included in both the free and paid workers plans and is priced at $0.30/million requests per month.

Screenshot 2024-06-26 at 18.09.29.png

III. Aspects to consider which hosting is the best suit for your Shopify hydrogen?

Choosing the right hosting solution for your Shopify Hydrogen storefront is crucial to ensuring optimal performance and reliability. Whether you opt for Shopify's native Oxygen, Vercel, Netlify, Fly.io, or Cloudflare, each platform offers unique advantages to meet your specific needs. Evaluate the features and costs of each to determine the best fit for your e-commerce business. By deploying your Hydrogen storefront to one of these robust hosting solutions, you can provide a seamless and engaging shopping experience for your customers, ultimately driving growth and success for your online store.

Read more: