Deploy to other runtimes
Choose a host that supports your framework and Hydrogen's runtime requirements.
Anchor to VercelVercel
If you're not using Oxygen, then we recommend deploying to Vercel. Vercel Shop, Vercel's Next.js template, deploys to Vercel with its default Next.js settings. To deploy, follow Vercel's Next.js on Vercel guide.
Anchor to Environment variablesEnvironment variables
Add your store's environment variables in Vercel's project settings. Server-only values don't use the NEXT_PUBLIC_ prefix. Vercel Shop's build fails until you set its required variables. For their names, refer to Vercel Shop's environment variables.
Anchor to Buyer IPBuyer IP
The buyer's IP address is the first address in the x-forwarded-for header:
Buyer IP on Vercel
lib/buyer-ip.tsAnchor to CacheCache
To use Vercel's runtime cache, install @vercel/functions, get the cache from it in proxy.ts, and pass it to the Storefront API client with the proxy event's waitUntil:
Vercel runtime cache
proxy.tsAnchor to Node, Cloudflare Workers, and DenoNode, Cloudflare Workers, and Deno
Use your framework's adapter for the runtime, and then do the following:
- Create the request context, Storefront API client, Customer Account API client, and session managers inside each request.
- Read the buyer IP from your platform's trusted header, and pass it as
buyerIptocreateShopifyRequestContext(). - Read secrets in server code only.
- If your platform has a cache and
waitUntil, then pass them to the Storefront API client. On Cloudflare Workers, usecaches.open()and the execution context'swaitUntil, as on Oxygen. - Confirm that
handleShopifyRoutes()runs before your router andhandleShopifyRedirects()runs after a 404 in the production build.