Hyperse
  • Pricing
  • FAQs
Newsletter

Subscribe to our newsletter

Receive weekly updates with latest collections and exclusive offers, straight to your inbox.

Hyperse

Headless commerce solutions for brands, developers, and modern ecommerce teams.

Explore

  • Home
  • About Us
  • Partners
  • FAQs

Legal & resources

  • Proposal
  • Privacy Policy
  • Terms & Conditions

© 2026 Hyperse. All rights reserved.


  1. Home
  2. Vendure Plugins
  3. hps-plugin-storage
hps-plugin-storage

hps-plugin-storage

By Hyperse

hps-plugin-storage is a Storage plugin in the Hub Core group.hps-plugin-storage provides Storage plugin capabilities for Hub Core. Core platform infrastructure and extension runtime. It is especially useful for core workflows.

CoreVendure Plugins

Specifications

Technical details and package information for this product.

Package

@hyperse-hub/hps-plugin-storage

Support by

Hyperse

Support languages

TypeScript, JavaScript, HTML, CSS, Prolog, Shell

Integration type

Core

Category

Vendure Plugins

Compatible with

^3.0.0

Latest version

1.1.6

Downloads

0

Repository

ssh://git@github.com/hyperse-hub/hub-core

Last published

July 14, 2026

Description
Changelog
loading...

On this page

  • @hyperse-hub/hps-plugin-storage
    • Table of contents
    • Features
    • Installation
    • Quick start
    • Provider-specific setup
      • Alibaba Cloud OSS
      • AWS S3
    • Configuration
    • Using the services
    • Package exports
    • Development and testing
    • License

@hyperse-hub/hps-plugin-storage

Vendure 3.x plugin that registers the Asset Server Plugin in one place and switches among local disk, Alibaba Cloud OSS, and AWS S3 storage. It exposes injectable DataStorageService and AssetHydrateService for asset URLs with preview dimensions, quality, and CDN rules, plus entity hydration.


Table of contents

  • Features
  • Installation
  • Quick start
  • Provider-specific setup
    • Alibaba Cloud OSS
    • AWS S3
  • Configuration
  • Using the services
  • Package exports
  • Development and testing
  • License

Features

  • Single registration of AssetServerPlugin: Do not add AssetServerPlugin again in vendure-config.plugins; duplicate registration throws.
  • Storage strategies (exactly one, selected by the key on the init object):
    • local: Filesystem uploads (default-style setup).
    • ali-oss: Alibaba Cloud OSS, with optional CDN image_process (and related) preview hydration.
    • aws-s3: Amazon S3 with presigned URLs and related behavior.
  • DataStorageService: Implements the extended HpsAssetStorageStrategy (multi-file streams, signed URLs, optional third-argument preview transforms on toAbsoluteUrl, etc.) using the same factory logic as the Asset Server.
  • : In request context, hydrates (and order-line ) to absolute URLs with presets / widths; aligns already-absolute URLs with the active storage preview rules (e.g. email templates).

Installation

yarn add @hyperse-hub/hps-plugin-storage

Peer dependencies

  • @vendure/core ^3.5.5
  • @nestjs/common and @nestjs/core ^11

Runtime

  • Node.js >= 20

Quick start

Register only this plugin in your Vendure config. You must set assetServerOptions.assetUrlPrefix to a non-empty string (public base URL for assets, often your CDN):


Provider-specific setup

Alibaba Cloud OSS

Pass an ali-oss block on init (accessKeyId, accessKeySecret, bucket, etc.). Optional fields such as cdnHydrate align CDN preview parameters with AssetHydrateService and the third argument to toAbsoluteUrl. See source types AliOssConfig and AliOssCdnHydrateOptions for the full shape.

AWS S3

Pass an aws-s3 block on init (credentials, bucket, etc.). See AwsS3Config in the source for details.


Configuration

OptionDescription
assetServerOptions.assetUrlPrefixRequired. Non-empty string. Function form is not supported.
assetServerOptions.routeSame role as in Vendure’s Asset Server; merged by the plugin by default.
assetServerOptions.presetsOptional; merged with built-in presets for AssetHydrateService (preset / targetWidth resolution).
assetServerOptions.storageStrategyFactoryUsually leave default; matches the factory used by DataStorageService.

During configure, the plugin validates route, assetUploadDir, and assetUrlPrefix and throws with explicit errors when invalid.


Using the services

DataStorageService.strategyName is one of 'local' | 'ali-oss' | 'aws-s3', useful for logging or branching.


Package exports

The main entry @hyperse-hub/hps-plugin-storage exports:

  • HpsPluginStorage
  • DataStorageService, AssetHydrateService, and hydrate-related types and helpers (e.g. mergeAssetServerPresets, normalizeAssetPreviewUrl, hydratePreviewUrlMode)
  • Storage strategy implementations and configure* factories (advanced customization)
  • Types such as PluginInitOptions, AssetServerOptions, SupportedStorageStrategy, HpsAssetStorageStrategy (alias HyperseAssetStorageStrategy), AssetPreviewUrlHydrateDescriptor, , and related definitions

src/helpers/* is used internally by strategy factories and is not re-exported from the package root; use it as a reference when implementing custom strategies.


Development and testing

cd packages/plugin-storage yarn build yarn test-unit # tests/** yarn test-e2e # e2e/**

License

MIT (same as the repository root).

AssetHydrateService
Asset.preview
featuredAsset
normalizePreviewUrl
import { join } from 'node:path';
import { HpsPluginStorage } from '@hyperse-hub/hps-plugin-storage';
export const config = {
plugins: [
HpsPluginStorage.init({
local: {
uploadPath: join(process.cwd(), 'static/assets'),
},
assetServerOptions: {
route: 'assets',
assetUrlPrefix: 'https://cdn.example.com/assets/',
},
}),
// Do not add AssetServerPlugin here again
],
};
import { AssetHydrateService, DataStorageService } from '@hyperse-hub/hps-plugin-storage';
// In a custom resolver or service
constructor(
private assetHydrate: AssetHydrateService,
private dataStorage: DataStorageService,
) {}
// Hydrate a single Asset preview (mutates the entity)
this.assetHydrate.hydrateAsset(ctx, product.featuredAsset, {
preset: 'medium',
// or targetWidth / quality
});
// Batch-hydrate order-line featured assets
await this.assetHydrate.hydrateOrderLineAssets(ctx, order, { preset: 'thumb' });
// Apply storage-consistent preview rules to an already-absolute URL (e.g. email HTML)
const url = this.assetHydrate.normalizePreviewUrl(absoluteUrl, { preset: 'small' });
resolveAssetPreviewUrlHydrateFromStrategy