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

ecom-widget

v1.6.0

Published

Embeddable 5-item infinite carousel widget

Readme


📦 Project Overview

This project is a fully embeddable e-commerce widget that allows you to:

  • ✅ Show 5 products per viewport
  • ✅ Scroll left/right with Prev/Next buttons
  • ✅ Infinite looping behavior
  • ✅ Fully responsive (desktop, tablet, mobile)
  • ✅ Pure Vanilla JavaScript (no frameworks)
  • ✅ Easily integrate into any website with one line of code
  • ✅ Host the widget yourself or through a CDN

🎯 Features

| Feature | Status | |---------------------------------|:------:| | Responsive Design | ✅ | | Horizontal Carousel with Scroll | ✅ | | 5 Items Per Viewport | ✅ | | Infinite Looping | ✅ | | Lightweight & Fast | ✅ | | Shadow DOM Isolation | ✅ | | No External Dependencies | ✅ |


🚀 Quick Start

1️⃣ Clone the repository

git clone https://github.com/your-username/your-widget-repo.git
cd your-widget-repo

2️⃣ Install dependencies

npm install

3️⃣ Start development server (Vite + HMR)

npm run dev

Opens http://localhost:5173 with live reload.

4️⃣ Build for production

npm run build

Outputs bundled widget.min.js to dist/

5️⃣ Preview production build

npx serve .

Serves widget.min.js in the preview.html available here: http://localhost:3000/preview


🛠 Usage Example

Paste this into any HTML page:

<div id="my-ecom-widget"></div>

<script src="https://your-cdn.com/widget.min.js"></script>
<script>
  window.EcomWidget.init({
    selector: '#my-ecom-widget',
    category: 'electronics'    // optional: API category
  });
</script>

✅ That's it! Your widget is now live and running inside any webpage.


✨ Widget Preview

Preview


⚙️ Configuration Options

| Property | Type | Default | Description | | ------------- | -------- | ------------------ | ---------------------------------------- | | selector | string | #my-ecom-widget | CSS selector where the widget mounts | | category | string | 'electronics' | Fake Store API category to fetch | | visibleCount| number | 5 | Number of cards visible per viewport |

Example:

window.EcomWidget.init({
  selector: '#your-div-id',
  category: 'jewelery',
  visibleCount: 5
});

📡 API Endpoints Used

  • GET products by category:
    https://fakestoreapi.com/products/category/{category}
  • POST add to cart:
    https://fakestoreapi.com/carts

(Free public test API — no API key required.)


🧩 Technology Stack

  • Pure Vanilla JavaScript (ES6+)
  • HTML + CSS inside Shadow DOM for isolation
  • Vite for development & bundling (IIFE output)
  • Zero runtime dependencies

📁 Project Structure

your-widget-repo/
├── widget.js            # Main widget source
├── vite.config.js       # Vite config for dev & build
├── package.json         # npm scripts & dependencies
├── .gitignore           # Ignored files (node_modules, dist, etc.)
└── dist/                # Production build output (widget.js)

.gitignore example:

node_modules/
dist/
.env
.DS_Store
.vscode/

📜 License

MIT License

You are free to use, modify, distribute, and contribute!


🤝 Contributing

Pull requests are very welcome!
For major changes, please open an issue first to discuss.

  1. Fork the repo
  2. Create a branch (git checkout -b feature/...)
  3. Commit your changes (git commit -m "feat: ...")
  4. Push (git push origin feature/...)
  5. Open a Pull Request

📬 Contact

If you like this project, feel free to connect: