medusa-plugin-stats
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Medusa-plugin-stats

banner image

medusa-plugin-stats is MedusaJS plugin to retreive store statistics data.

⚠️ Note - Plugin only tested for Postgres DB, and under active development.

Installation & Usage

  1. Run - yarn add medusa-plugin-stats or npm install medusa-plugin-stats

  2. Add plugin to your medusa-config.js -

plugins: [
  ...
  `medusa-plugin-stats`
  ]
  1. GET /admin/stats with following params will return the statictics data

Query params ->

{
  entity:[ "sales", "products", "orders", "customers"],
  start: "02-24-2022" // start date in MM-dd-yyyy format,
  end: "11-24-2022" // end date in MM-dd-yyyy format,
  period: "day" // day | week | month | year
}

Response ->

{
    "stats": {
        "sales": {
            "timeseries": {
                "10-20-2022": 1000
            },
            "metrics": {
                "total": 1000
            },
            "period": "day"
        },
        "products": {
            "timeseries": {
                "10-22-2022": 7
            },
            "metrics": {
                "total": "7"
            },
            "period": "day"
        },
        "orders": {
            "timeseries": {
                "10-20-2022": 1,
                "10-22-2022": 1,
                "10-25-2022": 1
            },
            "metrics": {
                "total": "3"
            },
            "period": "day"
        }
    }
}

Devlopment

  • [x] Refactor API to allow options to each resource type

  • [x] Add time series stats

  • [ ] Add more stat metrics & dimensions. Required Suggestions

  • [ ] Improve sales stat to allow multiple currencies

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.00latest

Version History

VersionDownloads (Last 7 Days)Published
0.1.00
0.0.90
0.0.80
0.0.70
0.0.60
0.0.50
0.0.40
0.0.30
0.0.20
0.0.10

Package Sidebar

Install

npm i medusa-plugin-stats

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

13.6 kB

Total Files

5

Last publish

Collaborators

  • anup22