Hydrogen is Shopify’s stack for headless commerce. Hydrogen is designed to dovetail with Remix, Shopify’s full stack web framework. This template contains a minimal setup of components, queries and tooling to get started with Hydrogen.
Check out Hydrogen docs Get familiar with Remix
- Remix
- Hydrogen
- Oxygen
- Shopify CLI
- ESLint
- Prettier
- GraphQL generator
- TypeScript and JavaScript flavors
- Minimal setup of components and routes
Requirements:
- Node.js version 16.14.0 or higher
npm create @shopify/hydrogen@latest
npm run build
npm run dev
- Go to your Shopify admin => Settings => Customer accounts => New customer account
- Setup a ngrok account and add a permanent domain (ie.
https://<your-ngrok-domain>.app
). - Install the ngrok CLI to use in terminal
- Start ngrok using
ngrok http --domain=<your-ngrok-domain>.app 3000
Important
To successfully interact with the Customer Account API routes you will need to use the ngrok domain during development instead of localhost
- Go to your Shopify admin =>
Hydrogen
orHeadless
app/channel => Customer Account API => Application setup - Edit
Callback URI(s)
to includehttps://<your-ngrok-domain>.app/account/authorize
- Edit
Javascript origin(s)
to include your public domainhttps://<your-ngrok-domain>.app
or keep it blank - Edit
Logout URI
to include your public domainhttps://<your-ngrok-domain>.app
or keep it blank
Modify your /app/entry.server.tsx
to allow the ngrok domain as a connect-src
- const {nonce, header, NonceProvider} = createContentSecurityPolicy()
+ const {nonce, header, NonceProvider} = createContentSecurityPolicy({
+ connectSrc: [
+ 'wss://<your-ngrok-domain>.app:*', // Your ngrok websocket domain
+ ],
+ });
Run npx shopify hydrogen link
or npx shopify hydrogen env pull
to link this app to your own test shop.
Alternately, the values of the required environment variables "PUBLIC_CUSTOMER_ACCOUNT_API_CLIENT_ID" and "PUBLIC_CUSTOMER_ACCOUNT_API_URL" can be found in customer account api settings in the Hydrogen admin channel.
Important
Note that mock.shop
doesn't supply these variables automatically and your own test shop is required for using Customer Account API
Note
B2B features such as contextual pricing is not available in SF API with Customer Account API login. If you require this feature, we suggest using the legacy-customer-account-flow. This feature should be available in the Customer Account API in the 2024-04 release.