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

@bfmeta/miniapp-selfhost-sync

v0.2.0

Published

Pull, mirror, and rewrite miniapp bundles for self-hosting.

Readme

miniapp-selfhost-sync

A Bun-first CLI for self-hosting remote miniapp bundles.

Runtime requirement

This tool is designed to run with Bun.

  • Required: bun >= 1.1.0
  • Node.js direct execution is not the target runtime for this package.

What it does

  • pulls metadata.json, source.json, and the latest .miniapp.zip
  • unpacks files to a local miniapp/ directory
  • rewrites url, icon, and optional website to your own host
  • stores local sync state and skips unchanged versions
  • generates both full nginx config and include snippets (N+1)
  • supports polling mode (default every 30s)

Install

npm i -g miniapp-selfhost-sync

Or use without global install:

bunx miniapp-selfhost-sync --help

Quick start

  1. Initialize config template to current directory:
miniapp-selfhost-sync --init

This creates ./miniapp-selfhost-sync.config.json.

  1. Edit it and run once:
miniapp-selfhost-sync --config ./miniapp-selfhost-sync.config.json --once
  1. Run polling mode:
miniapp-selfhost-sync --config ./miniapp-selfhost-sync.config.json

Config example

{
  "intervalMs": 30000,
  "requestTimeoutMs": 20000,
  "resourceHost": "https://miniapp-source.example.com/",
  "entries": [
    {
      "name": "app-a",
      "routePath": "hub",
      "enabled": true,
      "rawSourceUrl": "https://source-a.example.com/",
      "miniappHost": "https://hub.example.com/",
      "website": "https://www.example.com/",
      "outputDir": "./mirror/hub"
    }
  ]
}

CLI options

--config <path>    Config file path (default: ./miniapp-selfhost-sync.config.json)
--once             Run one sync pass and exit
--dry-run          Check updates only; do not write files
--init             Write miniapp-selfhost-sync.config.json to current directory
--force            Used with --init; overwrite existing file
--help             Show help

Config fields

Entry object fields:

  • name: Optional display name in logs.
  • routePath: Optional route segment on resource host, e.g. hub -> /hub/source.json.
  • enabled: Optional, defaults to true.
  • entryUrl / rawSourceUrl: at least one is required.
  • miniappHost: target public host URL.
  • website: optional override for website in manifest/source.
  • outputDir: local output directory.

Top-level optional fields:

  • resourceHost: domain used for subscription routes such as /hub/source.json.

Output layout

For each entry:

  • metadata.json
  • source.json
  • manifest-<version>.json
  • <id>-<version>.miniapp.zip
  • miniapp/ (unzipped current bundle)
  • .miniapp-sync-state.json

For resource host (N+1):

  • <config-dir>/_nginx/apps/<entry-route>/README.md
  • <config-dir>/_nginx/apps/<entry-route>/nginx-miniapp.v<sync-version>.conf
  • <config-dir>/_nginx/apps/<entry-route>/nginx-miniapp.v<sync-version>.inc.conf
  • <config-dir>/_nginx/resource/README.md
  • <config-dir>/_nginx/resource/nginx-resource.v<sync-version>.conf
  • <config-dir>/_nginx/resource/nginx-resource.v<sync-version>.inc.conf
  • <config-dir>/_nginx/all/README.md
  • <config-dir>/_nginx/all/nginx-all-in-one.v<sync-version>.inc.conf

Both nginx files include the sync script version in file name. The same version will not overwrite existing files.

License

MIT