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

medusa-export

v0.0.5

Published

A starter for Medusa plugins.

Downloads

174

Readme

Medusa Plugin: Export

A Medusa v2 plugin that provides data export functionality, allowing you to export data from any Medusa model to CSV format via admin API endpoints.

Features

  • Flexible Model Export: Export data from any Medusa model using remote query
  • CSV Format: Export data in CSV format for easy import into spreadsheets
  • Admin API Endpoint: Simple REST API endpoint for triggering exports
  • Automatic Data Handling: Handles different data types (dates, objects, null values)
  • Error Handling: Comprehensive error handling with meaningful error messages

Quick Start

  1. Install the plugin:
npm install medusa-export
  1. Add to medusa-config.ts:
import { defineConfig } from "@medusajs/framework/utils"

export default defineConfig({
  plugins: [
    {
      resolve: "medusa-export",
    },
  ],
})
  1. Use the API:
# Export data from a specific model
GET /admin/export/{model_name}

# Example: Export all products
GET /admin/export/product

# Example: Export all customers
GET /admin/export/customer

# Example: Export all orders
GET /admin/export/order

Installation

Local Development

  1. Publish the plugin to local registry:
cd medusa-export
npx medusa plugin:publish
  1. Install in your Medusa application:
cd ../your-medusa-app
npx medusa plugin:add medusa-export
  1. Register the plugin in medusa-config.ts:
import { defineConfig } from "@medusajs/framework/utils"

export default defineConfig({
  plugins: [
    {
      resolve: "medusa-export",
    },
  ],
})

API Reference

Export Data

Endpoint: GET /admin/export/{model_name}

Description: Exports all data from the specified Medusa model to CSV format.

Parameters:

  • model_name (path parameter): The name of the Medusa model to export (e.g., product, customer, order)

Response:

  • Success (200): Returns CSV file with Content-Type: text/csv and Content-Disposition: attachment
  • Error (400): Model name is required
  • Error (404): No data found in the specified model
  • Error (500): Failed to export data

Example Request:

curl -X GET "http://localhost:9000/admin/export/product" \
  -H "Authorization: Bearer {admin_token}" \
  -o products.csv

Example Response:

id,name,description,created_at,updated_at
prod_01...,"Product Name","Product Description","2024-01-01T00:00:00.000Z","2024-01-01T00:00:00.000Z"

Usage Examples

Export Products

GET /admin/export/product

Export Customers

GET /admin/export/customer

Export Orders

GET /admin/export/order

Export Custom Models

If you have custom models in your Medusa application, you can export them as well:

GET /admin/export/{your_custom_model_name}

Data Handling

The plugin automatically handles different data types:

  • Dates: Converted to ISO 8601 format
  • Objects: Serialized as JSON strings
  • Null/Undefined: Converted to empty strings
  • Strings: Properly escaped and quoted in CSV format

Compatibility

This plugin is compatible with Medusa v2.4.0 and above.

Requirements

  • Node.js >= 20
  • Medusa v2.4.0+

Development

Build

npm run build

Development Mode

npm run dev

License

MIT

Support

For issues and questions, please open an issue on the repository or contact the maintainers.