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

@for-the-people-initiative/storage

v0.1.0

Published

File storage module with capabilities-based adapter pattern.

Readme

@for-the-people/storage

File storage module with capabilities-based adapter pattern.

Packages

  • @for-the-people/storage-core - Core types, adapters, and service
  • @for-the-people/storage-api - Hono API routes

Quick Start

Installation

pnpm add @for-the-people/storage-core @for-the-people/storage-api

Basic Usage (Core)

import {
  StorageService,
  SupabaseStorageAdapter,
  InMemoryStorageAdapter,
} from '@for-the-people/storage-core';

// With Supabase
const adapter = new SupabaseStorageAdapter({
  url: 'https://your-project.supabase.co',
  key: 'your-anon-key',
});

// Or for testing
const adapter = new InMemoryStorageAdapter();

// Create service
const storage = new StorageService(adapter);

// Check capabilities
const caps = storage.getCapabilities();
console.log(`Provider: ${caps.provider}`);
console.log(`Max file size: ${caps.files.maxSizeBytes}`);

// Create bucket
const bucket = await storage.createBucket('avatars', { public: true });

// Upload file
const file = await storage.upload('avatars', 'user-123.png', fileBuffer, {
  contentType: 'image/png',
  upsert: true,
});

// Get public URL
const url = storage.getPublicUrl('avatars', 'user-123.png');

// Get signed URL (for private files)
const signedUrl = await storage.getSignedUrl('avatars', 'private-doc.pdf', {
  expiresIn: 3600, // 1 hour
  download: true,
});

// List files
const { files, hasMore } = await storage.list('avatars', {
  prefix: 'user-',
  limit: 50,
});

// Delete file
await storage.delete('avatars', 'user-123.png');

API Usage

import { Hono } from 'hono';
import { createApp } from '@for-the-people/storage-api';

// Create storage API
const storageApp = createApp({
  supabase: {
    url: process.env.SUPABASE_URL!,
    key: process.env.SUPABASE_KEY!,
  },
  corsOrigins: ['https://your-app.com'],
});

// Mount on your main app
const app = new Hono();
app.route('/', storageApp);

export default app;

API Endpoints

| Method | Path | Description | |--------|------|-------------| | GET | /api/v1/storage/capabilities | Get storage capabilities | | GET | /api/v1/storage/buckets | List all buckets | | POST | /api/v1/storage/buckets | Create bucket | | GET | /api/v1/storage/buckets/:name | Get bucket info | | DELETE | /api/v1/storage/buckets/:name | Delete bucket | | GET | /api/v1/storage/:bucket | List files in bucket | | POST | /api/v1/storage/:bucket?path=... | Upload file | | GET | /api/v1/storage/:bucket/:path | Download file | | GET | /api/v1/storage/:bucket/:path?info=true | Get file info | | GET | /api/v1/storage/:bucket/:path?url=true | Get signed URL | | GET | /api/v1/storage/:bucket/:path?public=true | Get public URL | | DELETE | /api/v1/storage/:bucket/:path | Delete file | | POST | /api/v1/storage/:bucket/move | Move file | | POST | /api/v1/storage/:bucket/copy | Copy file | | POST | /api/v1/storage/:bucket/upload-url | Get signed upload URL |

Capabilities

The adapter pattern exposes provider capabilities, allowing apps to adapt their behavior:

interface StorageCapabilities {
  provider: string;
  version: string;

  buckets: {
    public: boolean;
    private: boolean;
    maxBuckets: number;
  };

  files: {
    maxSizeBytes: number;
    allowedMimeTypes: string[] | '*';
    signedUrls: boolean;
    signedUrlMaxAge: number;
    publicUrls: boolean;
    transformations: boolean;
  };

  features: {
    folders: boolean;
    metadata: boolean;
    versioning: boolean;
    resumableUpload: boolean;
    multipartUpload: boolean;
  };
}

Adapters

Supabase Storage

Full-featured adapter for Supabase Storage:

  • Public and private buckets
  • Signed URLs (up to 7 days)
  • Image transformations (resize, crop, format conversion)
  • Resumable uploads

In-Memory (Testing)

Simple in-memory adapter for testing:

  • All bucket operations
  • Basic file operations
  • Fake URL generation
  • No image transformations

Creating Custom Adapters

Implement the StorageAdapter interface:

import type { StorageAdapter } from '@for-the-people/storage-core';

export class MyStorageAdapter implements StorageAdapter {
  readonly provider = 'my-provider';

  getCapabilities() {
    return {
      provider: 'my-provider',
      version: '1.0.0',
      // ... capabilities
    };
  }

  async upload(bucket, path, file, options) {
    // Implementation
  }

  // ... implement all methods
}

Development

# Install dependencies
pnpm install

# Build all packages
pnpm build

# Type check
pnpm typecheck

# Clean build artifacts
pnpm clean

License

MIT