sitemap
Builds a shop's XML sitemaps: it reads every product, category or page from a source, splits them into files of at most 50,000 URLs, and writes the files and their index to file storage.
When to use
Use it to publish sitemaps for a catalog too large to render on request. A
commerce engine provides the source, such as CommercetoolsProductSitemapSource
or MedusaProductSitemapSource, and a cloud adapter provides the storage the
files are written to. Run it as a scheduled job, or as a service whose
SitemapModule exposes rebuild routes. A storefront that renders its own
sitemap does not need it.
Get started
Install the package with the peer dependencies it needs. It comes from the Evolve registry, which needs a one-time sign-in.
pnpm add @evolve-framework/sitemap @evolve-framework/core fastifyRequirements3
@evolve-framework/core>= 1.0.0 < 2.0.0@types/node>=22optionalfastify>= 5.12.1 < 6.0.0
For example:
import { consistentPartitions, SitemapModule, SitemapService, SitemapWriter,} from "@evolve-framework/sitemap";import { source } from "./catalog.ts"; // from your commerce engineimport { storage } from "./storage.ts"; // from your cloud adapter
const service = new SitemapService({ source, writer: new SitemapWriter({ storage, bucket: "sitemaps", collection: "products", strategy: consistentPartitions(16), }), buildUrl: ({ locale, slug }) => `https://shop.example.com/${locale}/p/${slug}`,});
const module = new SitemapModule({ service, secret: process.env.SITEMAP_SECRET });Modules
SitemapModule
Hosts sitemap generation as a service.
The job script stays the primary way to run this — a scheduled container or
function invoking rebuild() directly. The module exists so the same routine
is reachable over HTTP, for a scheduler that can only make a request and for
rebuilding a few partitions after a content change without waiting for the
next scheduled run.
A rebuild is triggered rather than awaited: walking a catalog outlasts any sensible request timeout, so the route returns 202 and the report is logged.
import { SitemapModule } from "@evolve-framework/sitemap";new SitemapModule(options: SitemapModuleOptions)| Option | Type | Description |
|---|---|---|
service | SitemapService | The service the routes run: |
routes? | boolean | Publish the operational routes ( |
secret? | string | Shared secret required on the operational routes. When set, callers must
present |
Extends AbstractModule<unknown>.
Entry points
@evolve-framework/sitemap | SitemapService, SitemapWriter, the partition strategies, the source interface and SitemapModule with its rebuild routes.30 exports |
@evolve-framework/sitemap/testing | A fake source and entries, for testing a sitemap build without a commerce engine.2 exports |

