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

@kb0912/faire-plugin

v0.3.1

Published

Medusa V2 plugin for bidirectional sync with Faire wholesale marketplace.

Downloads

354

Readme

@kb0912/faire-plugin

Medusa V2 plugin for bidirectional sync between MedusaJS and Faire wholesale marketplace.

Features

🔄 Product Sync (Medusa → Faire)

  • Auto-create products on Faire when synced from Medusa
  • Auto-update existing Faire products when changed in Medusa (name, description, images, price)
  • Dynamic options mapping — product options (Size, Color, etc.) are read from Medusa, not hardcoded
  • Idempotent — uses idempotence_token to prevent duplicate products on Faire
  • Tracks Faire IDs — stores faire_product_id and faire_variant_map in product metadata for future updates

📦 Lifecycle State Sync

  • Medusa published → Faire PUBLISHED
  • Medusa draft → Faire DRAFT
  • Medusa delete → Faire DELETE
  • Real-time via product.updated and product.deleted event subscribers

📊 Inventory Sync

  • Listens to Medusa inventory-level.updated events
  • Syncs stocked_quantity (on-hand) to Faire via SKU matching
  • Uses Faire V2 API field on_hand_quantity

🛒 Order Import (Faire → Medusa)

  • Polls Faire API every 5 minutes for new orders (state=NEW)
  • Creates draft orders in Medusa (status pending) for manual review
  • Deduplicates via faire_order_id in order metadata
  • Fetches retailer info from Faire for customer details
  • Manual import trigger available via Admin UI or API

🖥️ Admin UI

  • Faire page in Medusa Admin with:
    • "Sync Products to Faire" button with result badges (created/updated/errors)
    • "Import Orders from Faire" button with result badges (imported/skipped/errors)
    • Info section explaining sync behavior

Installation

npm install @kb0912/faire-plugin
# or
yarn add @kb0912/faire-plugin

Configuration

Add the plugin to your medusa-config.ts:

module.exports = defineConfig({
  // ...
  plugins: [
    {
      resolve: "@kb0912/faire-plugin",
      options: {
        faire_api_key: process.env.FAIRE_API_KEY,
      },
    },
  ],
})

Environment Variables

| Variable | Required | Description | |----------|----------|-------------| | FAIRE_API_KEY | ✅ | Your Faire API access token (get it here) |

API Routes

| Method | Route | Description | |--------|-------|-------------| | POST | /admin/faire/sync | Trigger product sync to Faire | | POST | /admin/faire/orders | Trigger order import from Faire |

Data Mapping

Product Metadata (Medusa → Faire)

| Metadata Key | Description | |---|---| | faire_product_id | Faire product ID (e.g. p_xxx) | | faire_variant_map | JSON map: {medusa_variant_id: faire_variant_id} | | synced_to_faire | Boolean flag |

Order Metadata (Faire → Medusa)

| Metadata Key | Description | |---|---| | faire_order_id | Faire order ID (e.g. bo_xxx) | | faire_display_id | Human-readable Faire order ID | | faire_retailer_id | Faire retailer/buyer ID | | faire_retailer_name | Retailer company name | | faire_source | Order source (e.g. MARKETPLACE) | | faire_notes | Buyer notes | | faire_purchase_order_number | PO number |

Compatibility

  • Medusa V2 >= 2.4.0
  • Faire External API V2

License

MIT