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

@developerx12/serial-allocation

v0.1.3

Published

Serial number allocation plugin for Medusa v2

Readme

Serial Allocation Plugin for Medusa v2

A comprehensive serial number management plugin for Medusa v2. Track, allocate, and manage serial numbers across your product catalog with full order lifecycle integration.

Features

  • Serial Registration — Register serial numbers linked to product variants via SKU matching
  • Automatic Allocation — Serials are auto-assigned on order placement or fulfillment
  • Automatic Deallocation — Serials are released back to available when orders are cancelled
  • Manual Assignment — Assign specific serials to orders from the admin order detail page
  • Void Management — Void serials with reason tracking
  • Timeline Tracking — Full audit trail of all serial lifecycle events
  • Admin Dashboard — Dedicated serials management pages in the Medusa admin
  • Order Widget — Serial allocation status displayed directly on order detail pages
  • Store API — Customer-facing endpoints to view serials on their orders
  • Status Transitions — Enforced valid state transitions (available → allocated → voided)

Installation

npm install @developerx12/serial-allocation

Configuration

Add the plugin to your medusa-config.ts:

import { defineConfig } from "@medusajs/utils"

export default defineConfig({
  modules: [
    {
      resolve: "./serial-allcoaction",
      options: {
        auto_allocate_on_placed: true,
        auto_allocate_on_fulfillment: true,
        auto_deallocate_on_cancel: true,
      },
    },
  ],
})

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | auto_allocate_on_placed | boolean | false | Auto-allocate serials when an order is placed | | auto_allocate_on_fulfillment | boolean | false | Auto-allocate serials when an order is fulfilled | | auto_deallocate_on_cancel | boolean | false | Release serials back to available when an order is cancelled |

Data Models

Serial

| Field | Type | Description | |-------|------|-------------| | id | string | Primary key | | serial_number | string | Unique serial number | | sku | string | Product SKU | | variant_id | string | Product variant ID | | status | enum | available, allocated, voided |

Serial Item (Allocation)

| Field | Type | Description | |-------|------|-------------| | id | string | Primary key | | serial_id | string | Reference to serial | | order_item_id | string | Order item ID | | order_id | string | Order ID | | allocated_at | Date | Allocation timestamp |

Serial Timeline

| Field | Type | Description | |-------|------|-------------| | id | string | Primary key | | serial_id | string | Reference to serial | | event_type | string | created, allocated, deallocated, voided | | metadata | JSON | Event metadata |

Status Transitions

available  →  allocated
allocated  →  available  (deallocate)
allocated  →  voided
voided     →  (terminal)

API Routes

Admin Routes

| Method | Route | Description | |--------|-------|-------------| | GET | /admin/serial | List all serials (filterable by status, SKU, variant, serial_number) | | POST | /admin/serial/register | Register a new serial | | GET | /admin/serial/:id | Get serial detail with items | | DELETE | /admin/serial/:id | Delete an available serial | | POST | /admin/serial/:id/void | Void a serial | | POST | /admin/serial/:id/deallocate | Deallocate a serial | | POST | /admin/serial/:id/assign-order | Assign a serial to an order | | GET | /admin/serial/:id/timeline | Get serial timeline | | GET | /admin/serial/order/:order_id | Get serial status for an order |

Store Routes

| Method | Route | Description | |--------|-------|-------------| | GET | /store/serial | List serials for authenticated customer | | GET | /store/serial/:order_id | Get serials for a specific order |

Admin UI

Serials List Page (/serials)

  • View all serials with status badges
  • Search by serial number
  • Filter by status (available, allocated, voided)
  • Deallocate or delete serials from the list
  • Navigate to serial detail or register new serial

Serial Detail Page (/serials/:id)

  • View serial details (number, SKU, product, timestamps)
  • View allocation history
  • View full timeline of events
  • Actions: Delete, Void, Deallocate, Open Order

Register Page (/serials/register)

  • Register new serials by entering serial number and SKU
  • Automatically links to product variant via SKU lookup

Order Detail Widget

  • Shows serial allocation progress bar on fulfilled orders
  • Per-item breakdown with assigned serial numbers
  • "Assign Serial" button opens a modal to select and assign available serials
  • Filters available serials to match order items

Workflows

| Workflow | Trigger | Description | |----------|---------|-------------| | allocate-on-placed | order.placed | Auto-allocate serials for all order items | | register-serial | order.fulfillment_created | Auto-allocate serials for fulfillment items | | assign-serial-to-order | Manual | Assign a specific serial to an order | | deallocate-serial | Manual / Cancel | Release a serial from an order | | void-serial | Manual | Permanently void a serial | | delete-serial | Manual | Delete an available serial | | auto-assign-serial | Manual | Scan fulfillments and auto-match serials |

Development

# Install dependencies
npm install

# Build the plugin
npm run build

# Development mode
npm run dev

License

MIT