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

@platformatic/regina-storage

v1.3.0

Published

Pluggable storage adapters for Regina state backup

Readme

@platformatic/regina-storage

Pluggable storage adapters for Regina SQLite state backup and restore. Used by @platformatic/regina to persist instance state to shared storage for cross-pod migration in multi-pod deployments.

Adapters

graph LR
    SA["StorageAdapter<br/>interface"]
    SA --> FS["FsAdapter<br/>Local / NFS / EFS"]
    SA --> S3["S3Adapter<br/>AWS S3 / MinIO / R2"]
    SA --> RD["RedisAdapter<br/>Redis / Valkey"]

All adapters implement the same interface:

interface StorageAdapter {
  put(key: string, data: Buffer): Promise<void>
  get(key: string): Promise<Buffer | null>
  delete(key: string): Promise<void>
  list(prefix: string): Promise<string[]>
  close(): Promise<void>
}

Keys are instance IDs. Data is the raw SQLite file content.

FsAdapter

Stores files on the local (or network-mounted) filesystem. Suitable for shared volumes like NFS or AWS EFS.

import { FsAdapter } from '@platformatic/regina-storage'

const adapter = new FsAdapter({ basePath: '/mnt/shared/regina-state' })

await adapter.put('instance-abc123', sqliteBuffer)
const data = await adapter.get('instance-abc123')  // Buffer or null
await adapter.delete('instance-abc123')
const keys = await adapter.list('instance-')
await adapter.close()

| Option | Description | |---|---| | basePath | Directory where .sqlite files are stored |

Files are written as <basePath>/<key>.sqlite.

S3Adapter

Stores files in any S3-compatible object storage (AWS S3, MinIO, Cloudflare R2, etc.).

import { S3Adapter } from '@platformatic/regina-storage'

const adapter = new S3Adapter({
  bucket: 'regina-state',
  prefix: 'backups/',
  endpoint: 'https://s3.us-east-1.amazonaws.com',
  region: 'us-east-1'
})

| Option | Required | Description | |---|---|---| | bucket | Yes | S3 bucket name | | prefix | No | Key prefix (e.g., backups/) | | endpoint | No | S3 endpoint URL (for non-AWS providers) | | region | No | AWS region |

Objects are stored as <prefix><key>.sqlite.

RedisAdapter

Stores SQLite files as binary blobs in a Redis hash. The simplest option -- reuses an existing Redis connection if one is already available for pod registration.

import { Redis } from 'iovalkey'
import { RedisAdapter } from '@platformatic/regina-storage'

const redis = new Redis('redis://localhost:6379')
const adapter = new RedisAdapter({ client: redis })

| Option | Description | |---|---| | client | An existing iovalkey Redis client instance |

Data is stored in the regina:state hash: HSET regina:state <key> <data>.

The close() method is a no-op (the caller owns the Redis client lifecycle).

Usage with Regina

In platformatic.json, configure the storage option:

Filesystem

{
  "regina": {
    "storage": {
      "type": "fs",
      "basePath": "/mnt/shared/regina-state"
    }
  }
}

S3

{
  "regina": {
    "storage": {
      "type": "s3",
      "bucket": "regina-state",
      "endpoint": "https://s3.amazonaws.com"
    }
  }
}

Redis

{
  "regina": {
    "storage": {
      "type": "redis"
    }
  }
}

When type is redis, the adapter reuses the same Redis connection created for pod registration (if redis config is also set).

Adapter Selection Guide

flowchart TD
    A{Need shared storage?} -->|No| B["No adapter needed<br/>(single-pod mode)"]
    A -->|Yes| C{Already have Redis?}
    C -->|Yes| D["RedisAdapter<br/>Simplest setup,<br/>no extra infra"]
    C -->|No| E{Shared filesystem<br/>available?}
    E -->|Yes| F["FsAdapter<br/>NFS / EFS mount"]
    E -->|No| G["S3Adapter<br/>AWS S3 / MinIO / R2"]

License

Apache-2.0