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 🙏

© 2025 – Pkg Stats / Ryan Hefner

retro-dashboard

v0.0.4

Published

A flexible and customizable **React dashboard builder** for creating modern analytics dashboards with charts, KPIs, and filters — built with **React**, **MUI**, and **Chart.js**.

Readme

📊 Retro Dashboard

A flexible and customizable React dashboard builder for creating modern analytics dashboards with charts, KPIs, and filters — built with React, MUI, and Chart.js.



✨ Features

  • ⚡️ Plug-and-play dashboard builder
  • 📈 Prebuilt chart types — Bar, Line, Pie, Doughnut
  • 🧩 Configurable card and chart widgets
  • 🎨 MUI-based styling and theme profiles
  • 🔄 Automatic data refresh & filtering
  • 🌐 Built-in API integration via FeathersJS/REST

📦 Installation

Install via Yarn or npm:

# Using Yarn
yarn add retro-dashboard

# Using npm
npm install retro-dashboard

Required peer dependencies:

yarn add react react-dom chart.js react-chartjs-2

⚙️ Quick Usage Example

Below is a fully working dashboard configuration using DashboardBuilder.

"use client";

import React from "react";
import {
  DashboardBuilder,
  DashboardConfig,
  GlobalFilterConfig,
} from "retro-dashboard";
import { Divider, Typography } from "@mui/material";
import dayjs from "dayjs";
import restApp, { authCookieName } from "../../apis/rest.app";

// Dashboard structure configuration
const dashboardConfig: DashboardConfig = {
  id: "main-dashboard",
  gridSpacing: 2,
  themeProfiles: {
    primary: {
      bg: "linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%)",
      border: "#90caf9",
    },
    revenue: {
      bg: "#f3e5f5",
      border: "#ce93d8",
    },
    neutral: {
      bg: "#fafafa",
      border: "#e0e0e0",
    },
  },
  rows: [
    {
      id: "row-top",
      widgets: [
        {
          key: "kpi-1",
          type: "card",
          title: "Total Blogs",
          dataKey: "total_blogs",
          themeKey: "primary",
          size: { md: 4 },
          cardProps: {
            icon: "/images/dashboard/total-blogs.svg",
          },
        },
        {
          key: "kpi-2",
          type: "card",
          title: "Total Views",
          dataKey: "total_views",
          themeKey: "revenue",
          size: { md: 4 },
          cardProps: {
            icon: "/images/dashboard/total-views.svg",
          },
        },
        {
          key: "kpi-3",
          type: "card",
          title: "Total Categories",
          dataKey: "total_categories",
          themeKey: "neutral",
          size: { md: 4 },
          cardProps: {
            icon: "/images/dashboard/total-categories.svg",
          },
        },
      ],
    },
    {
      id: "row-charts",
      rowStyle: {
        minHeight: "400px",
      },
      widgets: [
        {
          key: "ticket-sales",
          type: "pie",
          title: "Video vs Normal",
          dataKey: "blog_type_chart",
          dataMapping: {
            labelsKey: "event_name",
            dataKey: "video",
            backgroundColor: ["#48666e", "#aaba63"],
          },
          chartOptions: {
            borderWidth: 5,
            borderColor: "#fff",
            showLegend: true,
          },
          size: { md: 6 },
        },
        {
          key: "bar-sales",
          type: "line",
          title: "Views",
          dataKey: "views_data",
          dataMapping: {
            labelsKey: "interval",
            dataKey: "count",
            backgroundColor: ["#48666e"],
          },
          size: { md: 6 },
        },
      ],
    },
    {
      id: "row-mixed",
      widgets: [
        {
          key: "weekly-sales",
          type: "bar",
          title: "Blogs",
          dataKey: "blog_data",
          dataMapping: {
            labelsKey: "interval",
            dataKey: "count",
            backgroundColor: ["#48666e"],
          },
          size: { md: 12 },
        },
      ],
    },
  ],
};

// Global filters configuration
const filters: GlobalFilterConfig[] = [
  {
    id: "sales_period",
    type: "period",
    payloadKey: "blog_graph_interval_data_filter_type",
    options: [
      {
        value: "last_7_days",
        label: "Last 7 Days",
        formatLable: [
          {
            keys: ["bar-sales", "weekly-sales"],
            modifyLabels: (labels) =>
              labels.map((label) => dayjs(label).format("ddd")),
          },
        ],
      },
      {
        value: "this_month",
        label: "This Month",
        formatLable: [
          {
            keys: ["bar-sales", "weekly-sales"],
            modifyLabels: (labels) => dayjs(label).format("DD")),
          },
        ],
      },
      { value: "custom", label: "Custom", customRange: true },
    ],
  },
];

export default function DashboardPage() {
  return (
    <div style={{ boxSizing: "border-box" }}>
      <Typography sx={{ fontWeight: 600, fontSize: 20 }}>
        Welcome, Admin
      </Typography>
      <Divider sx={{ my: 2 }} />
      <DashboardBuilder
        config={dashboardConfig}
        rowSpacing={1}
        showTitles
        apiEndpoint="v1/admin/admin-dashboard"
        authCookieName={authCookieName}
        restApp={restApp}
        method="POST"
        extraBodyParams={{
          statistics: true,
          blog_type_pie_chart_data: true,
          blog_graph_interval_data: true,
          views_graph_interval_data: true,
        }}
        globalFilterConfig={filters}
        autoRefetchOnFilterChange
        onGlobalFiltersChange={(filters) =>
          console.log("Filters changed:", filters)
        }
      />
    </div>
  );
}

🧩 DashboardBuilder Props

| Prop | Type | Description | | --------------------------- | ---------------------- | -------------------------------------- | | config | DashboardConfig | Dashboard layout and widget setup | | apiEndpoint | string | API endpoint to fetch dashboard data | | restApp | any | Feathers/REST client instance | | authCookieName | string | Cookie name for authentication | | method | "GET" \| "POST" | HTTP method for API calls | | extraBodyParams | object | Extra payload for API requests | | globalFilterConfig | GlobalFilterConfig[] | Global filters configuration | | onGlobalFiltersChange | (filters) => void | Callback triggered on filter changes | | autoRefetchOnFilterChange | boolean | Auto refresh data when filters change | | rowSpacing | number | Grid spacing between dashboard rows | | showTitles | boolean | Show/hide widget titles | | filterBoxStyle | CSSProperties | Custom styles for the filter container |

🧠 Types Overview

  • DashboardConfig — defines dashboard rows, widgets, and themes.
  • GlobalFilterConfig — defines filter controls and data bindings.

🪄 Supported Widget Types

| Type | Description | | ------------ | ------------------------- | | "card" | KPI or metric card | | "bar" | Bar chart (uses Chart.js) | | "line" | Line chart | | "pie" | Pie chart | | "doughnut" | Doughnut chart |

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.

🙏 Acknowledgements