@fast-simon/shopify-hydrogen

中文文档
1.0.21发布于 2026/11/08ISCTypeScriptCommonJS近 30 天下载 2800

Build Search and Discovery experience with Fast Simon, a Shopify Plus Certified Partner

原始使用文档
文档目录5 节
  1. Prerequisites
  2. Requirements
  3. Configure Hydrogen app config
  4. Expose Shopify Metafields
  5. Usage

Fast Simon & Shopify Integration

Build Search and Discovery experience with Fast Simon, a Shopify Plus Certified Partner

Getting started guide

Hydrogen App

Hydrogen is a React framework and SDK that you can use to build fast and dynamic Shopify custom storefronts.

Getting started guide

Fast Simon For Shopify Hydrogen

React NPM package to support Fast Simon Search and Discovery tools in Shopify Hydrogen Projects.

What is Fast Simon for Shopify Hydrogen?

Fast Simon Shopify Hydrogen is a React library to be used in Shopify Hydrogen apps.

By installing this library on your Hydrogen-based React Shopify storefront, you will be able to render Fast Simon Search and Discovery tools in your app.

Installation Guide

This document will guide you to:

  • Configure your Shopify store ready for Fast Simon Shopify Hydrogen.
  • Install and use Fast Simon Shopify Hydrogen components in your Shopify Hydrogen app.

Prerequisites

Before installation, authenticate with Fast Simon private NPM packages:

# NPM_TOKEN must hold a read-only token for the private @fast-simon scope.
# PowerShell: use "$env:NPM_TOKEN" — a bare "$NPM_TOKEN" expands to empty and sets no token.
npm config set "//registry.npmjs.org/:_authToken" "$NPM_TOKEN"

Never commit the token. See NPM_AUTH.md for how to obtain a read-only token for the private @fast-simon scope and export it as NPM_TOKEN.

Requirements

  • Shopify store
  • Hydrogen app
  • Fast Simon app installed on your Shopify store
  • Shopify custom app with Storefront access token

Configure Hydrogen app config

Update hydrogen.config.js with your shop's domain and Storefront API token.

Expose Shopify Metafields

Fast Simon Search and Discovery uses Metafields in order to customize the UI based on Fast Simon No-code editor configuration. Metafields need to be exposed so that they can be retrieved by your Hydrogen app.

Unfortunately, Shopify does not have a way of exposing Shop Metafields via their admin UI.

We strongly recommend to contact Fast Simon Support, we will expose the relevant Metafields for you.

How to Use Fast Simon In Your Hydrogen App

Installation

  1. In your Hydrogen app directory, run
npm install @fast-simon/shopify-hydrogen
  1. Create fastsimon.config.json file in your root directory and fill it with your Fast Simon UUID & store id:
{
    "UUID": "",
    "storeID": 0
}
  1. Open vite.config.ts and import the Fast Simon plugin:
import fastSimonPlugin from "@fast-simon/shopify-hydrogen/plugin";
  1. Add fastSimon()to the list of plugins:
  /// <reference types="vitest" />
  import {defineConfig} from 'vite';
  import hydrogen from '@shopify/hydrogen/plugin';
  import fastSimonPlugin from "@fast-simon/shopify-hydrogen/plugin";
  
  export default defineConfig({
      plugins: [hydrogen(), fastSimonPlugin()],
      resolve: {
          alias: [{find: /^~\/(.*)/, replacement: '/src/$1'}],
      },
      optimizeDeps: {
          include: ['@headlessui/react', 'clsx', 'react-use', 'typographic-base'],
      },
      test: {
          globals: true,
          testTimeout: 10000,
          hookTimeout: 10000,
      },
      server: {
          port: 5000
      },
  });
  1. Open App.server.tsx and import FastSimonProviderServer:
import fastSimonPlugin from "@fast-simon/shopify-hydrogen/plugin";
  1. Include the FastSimonProviderServer, passing through the request object, UUID and store id from your fastsimon.config.json file:
  function App({request}) {
      const pathname = new URL(request.normalizedUrl).pathname;
      const localeMatch = /^\/([a-z]{2})(\/|$)/i.exec(pathname);
      const countryCode = localeMatch ? localeMatch[1] : undefined;
      const isHome = pathname === `/${countryCode ? countryCode + '/' : ''}`;
  
      return (
          <Suspense fallback={<HeaderFallback isHome={isHome} />}>
              <ShopifyProvider countryCode={countryCode}>
                  <FastSimonProviderServer storeID={fastConfig.storeID} uuid={fastConfig.UUID} request={request}>
                      <CartProvider countryCode={countryCode}>
                          <Suspense>
                              <DefaultSeo />
                          </Suspense>
                          <Router>
                              <FileRoutes
                                  basePath={countryCode ? `/${countryCode}/` : undefined}
                              />
                              <Route path="*" page={<NotFound />} />
                          </Router>
                      </CartProvider>
                      <PerformanceMetrics />
                      {import.meta.env.DEV && <PerformanceMetricsDebug />}
                      <ShopifyAnalytics />
                  </FastSimonProviderServer>
              </ShopifyProvider>
          </Suspense>
      );
  }

You can also provide your UUID and storeID directly instead of creating the fastsimon.config.json

Usage

Collections:
  1. Open src/routes/collections/[handle].server.jsx and import FastSimonAppServer:
import {FastSimonAppServer} from "@fast-simon/shopify-hydrogen";
  1. To the collection handler function, add fastSimonProps parameter:
export default function Collection({params, fastSimonProps}) {...}
  1. Replace the Shopify Grid component by FastSimonAppServer, pass collectionID and fastSimonProps as shown below.
    <Layout>
        <Suspense>
            <Seo type="collection" data={collection} />
        </Suspense>
        <PageHeader heading={collection.title}>
            {collection?.description && (
                <div className="flex items-baseline justify-between w-full">
                    <div>
                        <Text format width="narrow" as="p" className="inline-block">
                            {collection.description}
                        </Text>
                    </div>
                </div>
            )}
        </PageHeader>
        <Section>
            <FastSimonAppServer collectionID={collection.id} fastSimonProps={fastSimonProps}/>
        </Section>
    </Layout>
Search Page:
  1. Open src/routes/search.server.jsx and import FastSimonAppServer:
import {FastSimonAppServer} from "@fast-simon/shopify-hydrogen";
  1. To the search handler function, add fastSimonProps parameter:
export default function Search({pageBy = PAGINATION_SIZE, params, fastSimonProps}) {...}
  1. Replace the Shopify Grid component by FastSimonAppServer, pass query and fastSimonProps as shown below.
  return (
    <SearchPage searchTerm={decodeURI(searchTerm)}>
        <Section>
            <FastSimonAppServer query={decodeURI(searchTerm)} fastSimonProps={fastSimonProps}/>
        </Section>
    </SearchPage>
);

版本与发布记录

@fast-simon/shopify-hydrogen 共发布 61 个版本,首次发布于 2022/11/16;过去 12 个月发布了 56 个版本。

版本发布日期距今
1.0.21latest2026/11/086 天前
1.0.22-beta.6beta2026/11/086 天前
1.0.22-beta.52026/11/059 天前
1.0.22-beta.42026/10/2222 天前
1.0.22-beta.32026/10/2222 天前
1.0.22-beta.22026/10/2222 天前

关于 @fast-simon/shopify-hydrogen 的常见问题

@fast-simon/shopify-hydrogen 是什么?

Build Search and Discovery experience with Fast Simon, a Shopify Plus Certified Partner

如何安装 @fast-simon/shopify-hydrogen?

在项目目录运行 npm install @fast-simon/shopify-hydrogen,或使用 pnpm add / yarn add / bun add。

@fast-simon/shopify-hydrogen 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@fast-simon/shopify-hydrogen 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@fast-simon/shopify-hydrogen 可以商用吗?

@fast-simon/shopify-hydrogen 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@fast-simon/shopify-hydrogen 的下载量有多少?

根据 npm 官方下载统计,@fast-simon/shopify-hydrogen 在 2026/10/15 – 2026/11/13 这 30 天内被下载 2,800 次,日均约 93 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fast-simon/shopify-hydrogen 还在维护吗?

最新版本 1.0.21 发布于 2026/11/08(6 天前);至今共发布 61 个版本,其中过去 12 个月发布了 56 个;首次发布于 2022/11/16。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。