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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@hocuspocus/extension-s3

v3.4.0

Published

a S3-compatible persistence driver for Hocuspocus

Readme

@hocuspocus/extension-s3

A S3-compatible persistence driver for Hocuspocus that stores Y.js documents in Amazon S3 or S3-compatible storage services like MinIO, DigitalOcean Spaces, etc.

Installation

npm install @hocuspocus/extension-s3

Quick Start

Basic AWS S3 Configuration

import { Server } from '@hocuspocus/server'
import { S3 } from '@hocuspocus/extension-s3'

const server = new Server({
  extensions: [
    new S3({
      bucket: 'my-documents-bucket',
      region: 'us-east-1',
      credentials: {
        accessKeyId: 'your-access-key',
        secretAccessKey: 'your-secret-key'
      }
    }),
  ],
})

server.listen()

MinIO Configuration

For local development with MinIO, ensure you set forcePathStyle: true:

const server = new Server({
  extensions: [
    new S3({
      bucket: 'hocuspocus-documents',
      endpoint: 'http://localhost:9000',
      forcePathStyle: true,
      credentials: {
        accessKeyId: 'minioadmin',
        secretAccessKey: 'minioadmin'
      }
    }),
  ],
})

Configuration Options

  • bucket (required): S3 bucket name where documents will be stored
  • region: AWS region (default: 'us-east-1')
  • prefix: Key prefix for documents (default: 'hocuspocus-documents/')
  • credentials: AWS credentials object with accessKeyId and secretAccessKey
  • endpoint: S3 endpoint URL (for S3-compatible services)
  • forcePathStyle: Use path-style URLs (required for MinIO, default: false)
  • s3Client: Custom S3Client instance

Document Storage

Documents are stored as binary files in S3 with the naming convention: {prefix}{documentName}.bin

Scaling with Redis

For horizontal scaling, combine S3 with the Redis extension. Redis handles real-time synchronization while S3 provides persistent storage.

import { Server } from '@hocuspocus/server'
import { Logger } from '@hocuspocus/extension-logger'
import { Redis } from '@hocuspocus/extension-redis'
import { S3 } from '@hocuspocus/extension-s3'

// Server 1
const server1 = new Server({
  name: "server-1",
  port: 8001,
  extensions: [
    new Logger(),
    new Redis({
      host: "127.0.0.1",
      port: 6379,
    }),
    new S3({
      bucket: 'hocuspocus-documents',
      endpoint: 'http://localhost:9000', // MinIO
      forcePathStyle: true,
      credentials: {
        accessKeyId: 'minioadmin',
        secretAccessKey: 'minioadmin'
      }
    }),
  ],
})

// Server 2 - same configuration with different name/port
const server2 = new Server({
  name: "server-2", 
  port: 8002,
  extensions: [/* same extensions */],
})

server1.listen()
server2.listen()

CLI Usage

You can also use the S3 extension with the Hocuspocus CLI:

# Basic usage
hocuspocus --s3 --s3-bucket my-documents

# MinIO setup (forcePathStyle automatically enabled)
hocuspocus --s3 --s3-bucket hocuspocus-documents --s3-endpoint http://localhost:9000

Development

Quick Start

For local development with MinIO (S3-compatible storage):

# Set up development environment
npm run dev:setup

# Test S3 configuration  
npm run dev:test-s3

# Run S3 playground examples
npm run playground:s3

Complete Documentation

For detailed documentation, examples, best practices, and troubleshooting, see: 📚 S3 Extension Documentation

IAM Permissions

Your AWS credentials or IAM role needs the following permissions:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["s3:GetObject", "s3:PutObject", "s3:HeadObject"],
      "Resource": "arn:aws:s3:::your-bucket-name/*"
    },
    {
      "Effect": "Allow", 
      "Action": ["s3:HeadBucket"],
      "Resource": "arn:aws:s3:::your-bucket-name"
    }
  ]
}