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

cryptomeacoffee

v1.1.0

Published

Open-source, self-hosted donation widget for accepting cryptocurrency donations via x402 protocol. Zero fees, direct to wallet.

Readme

☕ CryptoMeACoffee

Accept USDC donations on your website via x402 protocol. Zero fees, self-hosted, fully open-source.

npm version License: MIT Build Status Tests Coverage Code Quality PRs Welcome

✨ Features

  • Zero Platform Fees - Direct wallet-to-wallet via USDC
  • Self-Hosted - You control everything
  • Gasless for Users - x402 protocol sponsors gas fees
  • Instant Settlement - Funds arrive immediately
  • Buy Me a Coffee Style - Floating widget with modern UX
  • Easy Integration - One script tag or npm install
  • Message Support - Supporters can include messages (500 chars)

🚀 Quick Start

Via CDN (Easiest - No Build Required)

Add this to your HTML:

<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" href="https://unpkg.com/cryptomeacoffee@1/src/styles.css" />
  </head>
  <body>
    <!-- Auto-initialization from script tag data attributes -->
    <script
      src="https://unpkg.com/cryptomeacoffee@1/dist/widget.umd.js"
      data-wallet="0xYourWalletAddress"
      data-api="https://your-api.com/api/donate"
      data-creator-name="Your Name"
      data-color="#5F7FFF"
    ></script>
  </body>
</html>

Via NPM

npm install cryptomeacoffee
import CryptoMeACoffee from 'cryptomeacoffee';
import 'cryptomeacoffee/styles.css';

const widget = new CryptoMeACoffee({
  walletAddress: '0xYourAddress',
  apiEndpoint: 'https://your-api.com/api/donate',
  creatorName: 'Your Name',
});

widget.render('donation-widget');

⚙️ Configuration

Auto-Initialization (Recommended)

The widget auto-initializes from script tag data attributes:

<script
  src="https://unpkg.com/cryptomeacoffee@1/dist/widget.umd.js"
  data-wallet="0xYourWalletAddress"           <!-- Required -->
  data-api="https://your-api.com/api/donate"  <!-- Required -->
  data-creator-name="Your Name"               <!-- Optional -->
  data-color="#5F7FFF"                        <!-- Optional -->
  data-position="Right"                       <!-- Optional: Left/Right -->
  data-margin-x="18"                          <!-- Optional: pixels -->
  data-margin-y="18">                         <!-- Optional: pixels -->
</script>

Manual Initialization

const widget = new CryptoMeACoffee({
  // Required
  walletAddress: '0x...', // Your wallet address
  apiEndpoint: 'https://...', // Your x402 server endpoint

  // Optional
  creatorName: 'Your Name', // Shown in modal header
  presetAmounts: [1, 3, 5], // Preset donation amounts (USD)
  theme: 'light', // 'light' or 'dark'
  network: 'base-sepolia', // 'base-sepolia' or 'base'
  color: '#5F7FFF', // Primary color
  position: 'Right', // 'Left' or 'Right'
  marginX: 18, // Horizontal margin (px)
  marginY: 18, // Vertical margin (px)
  minAmount: 0.01, // Minimum donation (USD)
  maxAmount: 1000, // Maximum donation (USD)
});

🖥️ Server Setup Required

This widget requires a backend server running x402-express middleware. Choose your deployment method:

Option 1: Vercel (Serverless - Easiest) ⚡

Perfect for low-medium traffic, zero server management:

# Clone and deploy
git clone https://github.com/LazaroNacif/cryptomeacoffee
cd server-examples/vercel
cp .env.example .env
# Edit .env with your WALLET_ADDRESS
npm install
vercel deploy

Benefits:

  • Deploy in 60 seconds
  • Free tier: 100k requests/month
  • Auto-scaling
  • No server maintenance

See: server-examples/vercel/README.md


Option 2: Netlify (Serverless Alternative) 🌊

Similar to Vercel with excellent Git integration:

# Clone and deploy
git clone https://github.com/LazaroNacif/cryptomeacoffee
cd server-examples/netlify
cp .env.example .env
# Edit .env with your WALLET_ADDRESS
npm install
netlify deploy

Benefits:

  • Deploy in 60 seconds
  • Free tier: 125k requests/month
  • Deploy previews for PRs
  • Excellent Git workflow

See: server-examples/netlify/README.md


Option 3: Express (Traditional Server) 🖥️

Full control, best for high traffic or custom requirements:

# Clone repository
git clone https://github.com/LazaroNacif/cryptomeacoffee
cd server-examples/express

# Configure environment
cp .env.example .env
# Edit .env with your WALLET_ADDRESS

# Install and run
npm install
npm start

Deploy to: Railway, Render, Fly.io, VPS

See: server-examples/express/README.md


📊 Deployment Comparison

| Feature | Vercel | Netlify | Express | | --------------- | -------------- | -------------- | ------------ | | Setup Time | 1 min | 1 min | 5 min | | Free Tier | 100k req/month | 125k req/month | N/A | | Cold Starts | ~500ms | ~500ms | None | | Max Timeout | 10s (60s Pro) | 10s (26s Pro) | Unlimited | | Scaling | Automatic | Automatic | Manual | | Best For | Quick deploys | Git workflows | High traffic | | Cost (idle) | $0 | $0 | Server cost |

📖 Documentation

Comprehensive guides available in the docs/ directory:

🌐 Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)
  • Mobile browsers (iOS Safari, Chrome Android)

Requires: MetaMask or Coinbase Wallet browser extension

🏗️ Technical Stack

  • Frontend: Viem for wallet interaction
  • Backend: x402-express official middleware
  • Protocol: x402 (gasless USDC transfers)
  • Network: Base (Ethereum L2)
  • Token: USDC

📦 Bundle Size

  • UMD Bundle: 459 KB (133 KB gzipped)
  • Includes: viem + x402 client library (no external dependencies)

📁 Project Structure

cryptomeacoffee/
├── src/                  # Source code
│   ├── widget.js         # Main widget class
│   ├── logger.js         # Environment-aware logging
│   └── styles.css        # Widget styles
├── dist/                 # Build output (generated)
│   ├── widget.umd.js     # UMD bundle for CDN
│   ├── widget.es.js      # ES module bundle
│   └── widget.d.ts       # TypeScript definitions
├── tests/                # Test files
│   ├── unit/            # Unit tests (46 tests, 31% coverage)
│   └── integration/     # Integration tests
├── docs/                 # Documentation
│   ├── SETUP-GUIDE.md   # Complete setup instructions
│   ├── API-REFERENCE.md # Full API documentation
│   ├── SECURITY-CHECKLIST.md
│   ├── FAQ.md           # Frequently asked questions
│   └── CUSTOMIZATION.md # Theming and styling
├── examples/            # Usage examples
│   ├── vanilla-html/    # Pure HTML/JS example
│   └── server-examples/ # Backend implementations
│       └── express/     # Express.js server
├── CHANGELOG.md         # Version history
└── CONTRIBUTING.md      # Contribution guidelines

🤝 Contributing

Contributions are welcome! Please read our Contributing Guide for details on:

  • Setting up development environment
  • Code style guidelines
  • Testing requirements
  • Pull request process

See also: CHANGELOG.md for version history.

📄 License

MIT - See LICENSE file

🔗 Links

💬 Support


Built with ❤️ using the x402 protocol