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

@fonderie/media

v0.2.25

Published

Provider-abstracted asset storage — upload, store, and serve user-owned images (avatars, logos) with a DB-blob backend by default and object storage as a one-line swap.

Readme

@fonderie/media

Provider-abstracted asset storage for Fonderie — upload, store, and serve user-owned images (avatars, workspace logos, customer photos) with zero infrastructure by default and object storage as a one-line swap.

Every SaaS needs profile images; getting the bytes right (magic-byte validation, size caps, SVG/stored-XSS rejection, cacheable public serving) is security-sensitive boilerplate you shouldn't re-derive per app. This brick owns it once.

What you get

  • POST /media — upload a base64 image (guarded: magic-byte sniffing, size cap, SVG rejected), returns a /media/:id URL.
  • GET /media/:id — public, cached image serving (an <img src> can't send a Bearer token), with ETag/304.
  • DELETE /media/:id — uploader-only removal.

The read contract is monomorphic: consumers always get a URL, whatever the backend. Point @fonderie/auth's avatarUrl (or @fonderie/customers') at it.

Wire it

import { MediaModule, DbBlobProvider } from '@fonderie/media';

app.register(new MediaModule(store, {
  provider: new DbBlobProvider(store), // zero infra — bytes live in Postgres
  maxBytes: 1_000_000,
}));

Run both migrations — media's (fonderie_media_assets metadata) and @fonderie/storage's (fonderie_storage_blobs, where DbBlobProvider writes). Forgetting storage's makes DbBlob uploads fail at runtime:

import { getMigrationsPath as mediaMigrations }   from '@fonderie/media/migrations';
import { getMigrationsPath as storageMigrations } from '@fonderie/storage/migrations';
await new InternalMigrationRunner(store, storageMigrations()).run();
await new InternalMigrationRunner(store, mediaMigrations()).run();

Storage & access

Byte storage lives in @fonderie/storage (media re-exports the zero-infra providers for convenience):

  • DbBlobProvider — bytes in Postgres. Zero infra; the default.
  • LocalFsProvider — bytes on disk.
  • S3Provider (S3 / MinIO / R2) — import { S3Provider } from '@fonderie/storage/s3'.

Swapping backends is one config line; the /media/:id URL contract is unchanged.

Access model: GET /media/:id is public — an <img src> can't carry a Bearer token, and ids are unguessable UUIDs (capability URLs). Right for avatars/logos; it is not an access-controlled store for private or sensitive files — serve those through your own authenticated route.

Owner authorization: uploads default to self-owned user assets only (ownerType: 'user', ownerId = the caller). To allow workspace logos, customer photos, etc., pass authorizeOwner(ctx, owner) in the module config.