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

@commercejs/storage-s3

v0.2.0

Published

S3-compatible storage provider for CommerceJS — works with AWS S3, Cloudflare R2, DigitalOcean Spaces, MinIO

Readme

@commercejs/storage-s3

S3-compatible storage provider for Commerce.js — works with AWS S3, Cloudflare R2, DigitalOcean Spaces, MinIO, and any S3-protocol service.

Install

pnpm add @commercejs/storage-s3

Quick Start

import { createCommerce } from '@commercejs/core'
import { S3StorageProvider } from '@commercejs/storage-s3'

const storage = new S3StorageProvider({
  endpoint: 'https://s3.us-east-1.amazonaws.com',
  region: 'us-east-1',
  bucket: 'my-store-assets',
  accessKeyId: process.env.S3_ACCESS_KEY_ID!,
  secretAccessKey: process.env.S3_SECRET_ACCESS_KEY!,
  publicUrl: 'https://cdn.example.com', // optional CDN
})

const commerce = createCommerce({
  adapter: myAdapter,
  storage,
})

Usage

Server-side upload

const result = await commerce.uploadFile({
  filename: 'hero.jpg',
  mimeType: 'image/jpeg',
  content: imageBytes, // Uint8Array
  directory: 'products',
})
// → { key: 'products/hero-a1b2c3d4.jpg', url: 'https://cdn.example.com/products/hero-a1b2c3d4.jpg' }

Client-side direct upload (presigned URL)

// Server: generate a presigned upload URL
const { url, headers } = await commerce.getPresignedUploadUrl('products/hero.jpg', {
  contentType: 'image/jpeg',
  expiresIn: 600, // 10 minutes
})

// Client (browser): upload directly to S3
await fetch(url, { method: 'PUT', headers, body: file })

Delete

await commerce.deleteFile('products/hero-a1b2c3d4.jpg')

Get URL

const url = commerce.getFileUrl('products/hero-a1b2c3d4.jpg')
// → 'https://cdn.example.com/products/hero-a1b2c3d4.jpg'

Private file download (presigned)

const { url } = await commerce.getPresignedDownloadUrl('invoices/inv-001.pdf', {
  expiresIn: 900, // 15 minutes
})

S3-Compatible Services

// AWS S3
new S3StorageProvider({ endpoint: 'https://s3.us-east-1.amazonaws.com', region: 'us-east-1', ... })

// Cloudflare R2
new S3StorageProvider({ endpoint: 'https://<account>.r2.cloudflarestorage.com', region: 'auto', ... })

// DigitalOcean Spaces
new S3StorageProvider({ endpoint: 'https://nyc3.digitaloceanspaces.com', region: 'nyc3', ... })

// MinIO (self-hosted)
new S3StorageProvider({ endpoint: 'http://localhost:9000', region: 'us-east-1', forcePathStyle: true, ... })

// Supabase S3
new S3StorageProvider({ endpoint: 'https://<project>.supabase.co/storage/v1/s3', region: 'auto', ... })

Configuration

| Option | Type | Required | Description | |---|---|---|---| | endpoint | string | ✅ | S3-compatible endpoint URL | | region | string | ✅ | Region ('us-east-1', 'auto' for R2) | | bucket | string | ✅ | Bucket name | | accessKeyId | string | ✅ | Access key ID | | secretAccessKey | string | ✅ | Secret access key | | publicUrl | string | | CDN base URL for public files | | prefix | string | | Global key prefix (e.g., 'uploads/') | | forcePathStyle | boolean | | Path-style URLs (required for MinIO) |

License

MIT