npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@hszrdm/create-commerce

v1.29.0

Published

Create a complete HSZRDM Commerce webshop project.

Downloads

7,163

Readme

@hszrdm/create-commerce

Creates a complete standalone HSZRDM Commerce webshop project.

npx @hszrdm/create-commerce my-shop

The generator creates:

  • a Medusa backend powered by @hszrdm/core;
  • a client-owned Next.js storefront;
  • random application and integration secrets;
  • Medusa + Core migrations;
  • Store / Region / Sales Channel / Stock Location bootstrap;
  • a publishable storefront API key linked to the Sales Channel;
  • the first HSZRDM Commerce admin user;
  • backend/storefront typecheck, test and build verification;
  • Git initialization with generated build artifacts ignored;
  • production deployment, backup and restore assets.

Generated project structure includes:

my-shop/
├── backend/
├── storefront/
├── deploy/
│   ├── install.sh
│   ├── deploy.sh
│   ├── backup.sh
│   └── restore.sh
├── ecosystem.config.cjs
├── docker-compose.yml
├── hszrdm-commerce.json
├── package.json
└── README.md

The deploy/ directory and ecosystem.config.cjs are materialized automatically during the first npm install. If the generator is run with --skip-install, running npm install later creates them.

Core upgrades and customer-owned frontends

Backend Core is the versioned @hszrdm/core npm dependency. The customer adds Medusa modules, APIs, workflows, jobs and subscribers under backend/src/project/. The generator's prepare:project step exposes them through standard Medusa paths without duplicating the Core implementation.

Reference frontend lives under starters/storefront-next/ in the Core repository. Each generated storefront/ is customer-owned: the customer can build their own branding, layouts and pages. Changing or releasing the reference frontend does not automatically overwrite customer files.

Backend upgrades and frontend synchronization are separate operations. Run them in a clean Git checkout on a feature branch, not the live VPS. First publish matching @hszrdm/core and @hszrdm/create-commerce versions.

1. Upgrade Core backend independently

npx @hszrdm/create-commerce@<new-version> upgrade --dir .
# Review the UPDATE, REVIEW and CONFLICT output:
npx @hszrdm/create-commerce@<new-version> upgrade --dir . --apply
npm ci
npm run verify
git diff --check

The backend command updates verified, unchanged starter infrastructure, package versions (including older shops that pin Core at workspace and root level), the Core-owned npm root security overrides, and the lockfile. It preserves backend/src/project/ and customer-owned files. Production backup entry points (deploy/backup.sh and backend/scripts/production-assets/backup.sh) always remain customer-owned and appear as REVIEW even when an older manifest tracks them, because automatic replacement could switch the backup format or environment contract. Changed or untracked backend starter overlays are kept unchanged and marked REVIEW for compatibility checks. Unsafe paths, mismatched Core pins and overridden security pins are CONFLICT and block application. Never deploy before resolving compatibility reviews and running the full test suite.

The backend command deliberately does not modify storefront/ or storefront/package.json. Updating the backend package and database migrations does not, by itself, guarantee custom frontend compatibility.

2. Compare and optionally sync the reference frontend

npx @hszrdm/create-commerce@<new-version> frontend:sync --dir .
# Optional unified diffs for modified client files:
npx @hszrdm/create-commerce@<new-version> frontend:sync --dir . --diff
# Explicit opt-in: copies only provably unmodified reference files and
# adds missing reference files; leaves customer-modified paths untouched.
npx @hszrdm/create-commerce@<new-version> frontend:sync --dir . --apply

npm ci
npm run verify
git diff --check

The preview lists SAFE files, REVIEW customer changes and PACKAGE REVIEW Next/React dependency differences. Existing customer edits and deleted files with known baselines are never force-restored. The frontend package dependencies, theme, layout and any modified pages/components remain owned by the customer and must be reconciled manually where necessary. The preview/apply does not bump hszrdm-commerce.json Core backend version, touch the DB, change secrets or deploy anything.

The hszrdm-managed.json manifest stores the last accepted file hashes; frontend baselines are not falsely advanced by a backend-only upgrade. Avoid re-baselining modified customer files as if they were canonical.

New projects expose npm run upgrade:core and npm run sync:frontend as previews, with npm run <script> -- --apply for the explicit operation. For reproducible releases pin the generator version, not @latest.

3. Review, commit and deploy

Commit package.json, package-lock.json, backend/, storefront/, hszrdm-commerce.json and hszrdm-managed.json only after reviewing all changes and passing npm run verify. Test checkout, payments, order fulfillment, shipping and customer modules in staging, then deploy the committed customer branch.

Legacy shops without a reliable manifest must not treat customized starter files as Core-owned. Run previews first and manually review existing overlays. Never use --force to regenerate an existing webshop.

Production commands

Fresh server install

On a new VPS/server, deploy/install.sh can bootstrap the production environment automatically.

bash deploy/install.sh

If backend/.env does not exist, the installer:

  1. copies the canonical backend/.env.example to backend/.env;
  2. reads project identity from hszrdm-commerce.json;
  3. asks for PostgreSQL, Redis, public backend URL and public storefront URL;
  4. generates fresh JWT, cookie, integration-encryption and shipping-webhook secrets;
  5. fills store identity, CORS, SEO and default project e-mail values;
  6. creates storefront/.env.local from the storefront env example;
  7. runs env:verify, migrations and Core bootstrap;
  8. creates a Store API publishable key when the storefront does not already have one;
  9. builds and starts/reloads the apps through PM2;
  10. runs backend/storefront healthchecks.

If backend/.env or storefront/.env.local already exists, the installer preserves them instead of regenerating secrets.

For non-interactive/server automation, supply the server-specific values through:

HSZRDM_INSTALL_DATABASE_URL='postgres://...' \
HSZRDM_INSTALL_REDIS_URL='redis://...' \
HSZRDM_INSTALL_BACKEND_URL='https://api.example.com' \
HSZRDM_INSTALL_STOREFRONT_URL='https://example.com' \
HSZRDM_INSTALL_UPLOAD_DIR='/var/lib/hszrdm-commerce/my-shop/uploads' \
bash deploy/install.sh

HSZRDM_INSTALL_UPLOAD_DIR is optional. Its default is /var/lib/hszrdm-commerce/<project-slug>/uploads.

Normal deployment

bash deploy/deploy.sh

The deploy script creates a backup first, pulls with git pull --ff-only, installs exact dependencies, verifies the env contract, runs migrations/Core init, builds, reloads PM2 and performs healthchecks.

Manual backup

bash deploy/backup.sh

Restore an existing webshop

bash deploy/restore.sh /path/to/hszrdm-commerce-YYYYMMDDTHHMMSSZ.tar.gz --yes

For an existing webshop moved to another VPS, use restore, not a fresh env bootstrap. Restore brings back the original backend/storefront env files, database, encrypted Core runtime state and uploads. This preserves encryption keys and existing integration credentials.

Backups contain the PostgreSQL dump, backend/storefront environment files, encrypted Core runtime state and uploaded files when present. Backup archives therefore contain secrets and customer data and must be stored securely.

The default local backup retention is 5 archives. It can be changed with:

HSZRDM_BACKUP_RETENTION=10 bash deploy/backup.sh

A different backup directory can be supplied with HSZRDM_BACKUP_DIR.

PostgreSQL and Redis

Docker is optional.

Use an existing PostgreSQL + Redis pair:

npx @hszrdm/create-commerce my-shop \
  --database-url "postgres://user@localhost:5432/my_shop" \
  --redis-url "redis://localhost:6379"

When both URLs are provided, Docker is not used.

If no external URLs are provided, Docker Compose is the convenience fallback and starts isolated PostgreSQL and Redis services when Docker is available.

The two external connection options must always be supplied together.

Non-interactive example

npx @hszrdm/create-commerce my-shop \
  --database-url "postgres://user@localhost:5432/my_shop" \
  --redis-url "redis://localhost:6379" \
  --admin-email "[email protected]" \
  --non-interactive

If no admin password is supplied, the generator creates a random password and prints it once at the end. It is not written to project metadata.

Use --help for all options.