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

@opensaas/stack-storage-s3

v0.20.0

Published

AWS S3 storage provider for OpenSaas Stack file uploads

Readme

@opensaas/stack-storage-s3

AWS S3 storage provider for OpenSaas Stack file uploads.

Installation

pnpm add @opensaas/stack-storage @opensaas/stack-storage-s3

Usage

// opensaas.config.ts
import { config, list } from '@opensaas/stack-core'
import { s3Storage } from '@opensaas/stack-storage-s3'
import { image } from '@opensaas/stack-storage/fields'

export default config({
  storage: {
    avatars: s3Storage({
      bucket: 'my-avatars',
      region: 'us-east-1',
      accessKeyId: process.env.AWS_ACCESS_KEY_ID,
      secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
    }),
  },
  lists: {
    User: list({
      fields: {
        avatar: image({ storage: 'avatars' }),
      },
    }),
  },
})

Configuration Options

s3Storage({
  // Required
  bucket: string                    // S3 bucket name
  region: string                    // AWS region (e.g., 'us-east-1')

  // Optional - Authentication
  accessKeyId?: string              // AWS access key (or use IAM role)
  secretAccessKey?: string          // AWS secret key (or use IAM role)

  // Optional - S3-compatible services
  endpoint?: string                 // Custom endpoint (e.g., 'https://s3.backblazeb2.com')
  forcePathStyle?: boolean          // Force path-style URLs (required for some services)

  // Optional - Storage options
  pathPrefix?: string               // Prefix for all files (e.g., 'uploads/')
  generateUniqueFilenames?: boolean // Generate unique filenames (default: true)
  acl?: string                      // ACL for uploaded files (default: 'private')

  // Optional - Public URLs
  customDomain?: string             // Custom domain for public URLs (e.g., 'https://cdn.example.com')
})

Examples

Standard AWS S3

avatars: s3Storage({
  bucket: 'my-bucket',
  region: 'us-east-1',
  accessKeyId: process.env.AWS_ACCESS_KEY_ID,
  secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
  acl: 'public-read',
})

With IAM Role (No Keys)

avatars: s3Storage({
  bucket: 'my-bucket',
  region: 'us-east-1',
  // No accessKeyId/secretAccessKey - uses IAM role
})

With CloudFront CDN

avatars: s3Storage({
  bucket: 'my-bucket',
  region: 'us-east-1',
  customDomain: 'https://d123456789.cloudfront.net',
})

Backblaze B2

files: s3Storage({
  bucket: 'my-bucket',
  region: 'us-west-000',
  endpoint: 'https://s3.us-west-000.backblazeb2.com',
  forcePathStyle: true,
  accessKeyId: process.env.B2_KEY_ID,
  secretAccessKey: process.env.B2_APPLICATION_KEY,
})

MinIO (Self-Hosted)

files: s3Storage({
  bucket: 'my-bucket',
  region: 'us-east-1',
  endpoint: 'http://localhost:9000',
  forcePathStyle: true,
  accessKeyId: 'minioadmin',
  secretAccessKey: 'minioadmin',
})

DigitalOcean Spaces

files: s3Storage({
  bucket: 'my-space',
  region: 'nyc3',
  endpoint: 'https://nyc3.digitaloceanspaces.com',
  forcePathStyle: false,
  accessKeyId: process.env.DO_SPACES_KEY,
  secretAccessKey: process.env.DO_SPACES_SECRET,
  customDomain: 'https://my-space.nyc3.cdn.digitaloceanspaces.com',
})

ACL Options

  • 'private' - Only bucket owner has access (default)
  • 'public-read' - Public read access
  • 'public-read-write' - Public read/write access
  • 'authenticated-read' - Authenticated AWS users have read access

Signed URLs

The S3 provider supports signed URLs for private files:

import { createStorageProvider } from '@opensaas/stack-storage/runtime'

const provider = createStorageProvider(config, 'avatars')

// Get signed URL valid for 1 hour
const signedUrl = await provider.getSignedUrl('filename.jpg', 3600)

Environment Variables

Recommended setup:

AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key
AWS_REGION=us-east-1
AWS_BUCKET=your-bucket

License

MIT