Skip to content

shawnyeager/hugo-v4v

Repository files navigation

hugo-v4v

Accept Bitcoin Lightning payments on Hugo sites. Includes Netlify proxy, payment page template, and analytics CLI.

V4V Dashboard CLI dashboard with mock data

V4V Payment Page Hugo payment page

Quick Start

npm install
./bin/v4v init    # Interactive setup wizard

Or manually create a .env file (see .env.example):

NWC_CONNECTION_STRING=nostr+walletconnect://...
V4V_SITE_URL=yourdomain.com

Commands

Setup & Status

./bin/v4v init              # Interactive setup wizard
./bin/v4v status            # Check connection and config status

Reports

./bin/v4v report                    # Basic payment summary
./bin/v4v report --usd              # Include USD values
./bin/v4v report --by-essay         # Breakdown by essay/page
./bin/v4v report --time-series      # Monthly trend
./bin/v4v report --compare          # Compare to previous period

# Date filtering
./bin/v4v report --since 7d         # Last 7 days (also: 2w, 1m, 3mo, 1y)
./bin/v4v report --from 2024-01-01  # From specific date
./bin/v4v report --from 2024-01-01 --to 2024-01-31

# Output formats
./bin/v4v report --format json      # JSON output
./bin/v4v report --format csv       # CSV to stdout
./bin/v4v report --export data.csv  # CSV to file

Dashboard

./bin/v4v dashboard                 # Start web dashboard (port 3000)
./bin/v4v dashboard -p 8080         # Custom port
./bin/v4v dashboard --mock          # Use mock data for demos

Dashboard features:

  • Time range filtering (7d, 30d, 90d, 12mo, All)
  • Sortable source table with drill-down
  • Weekly trend chart
  • Mobile responsive
  • URL state persistence (?range=7&sort=sats)

Cache Management

./bin/v4v cache                     # Show cache stats
./bin/v4v cache --clear             # Clear cache
./bin/v4v cache --rebuild           # Clear and fetch all transactions fresh

Important: The CLI caches transactions locally and only fetches new ones on subsequent runs. If you're missing older payments, run --rebuild to fetch your complete transaction history.

Use --rebuild when:

  • Payments you know exist aren't showing up in reports
  • You've cleared or corrupted the cache
  • You want to ensure you have complete data

CLI Options

./bin/v4v --no-color               # Disable colored output
./bin/v4v --help                   # Show help
./bin/v4v --version                # Show version

Colored output respects the NO_COLOR environment variable.

Configuration

Environment Variable Description Default
NWC_CONNECTION_STRING NWC connection URL (required) -
V4V_SITE_URL Site URL for filtering payments (required) -
V4V_RSS_URL RSS feed URL for essay titles https://{site}/feed.xml
NWC_TIMEOUT NWC request timeout in ms 120000
V4V_MAX_BATCHES Max transaction batches to fetch (~10 tx/batch) 100
V4V_BATCH_DELAY Delay between batches in ms 300

How the CLI Works

  1. Connects to your Alby Hub (or any NWC provider) via Nostr Wallet Connect
  2. Fetches incoming Lightning payments and caches them locally (.v4v-cache.json)
  3. On subsequent runs, only fetches transactions newer than the cache
  4. Filters for V4V payments (containing your site URL in description)
  5. Fetches essay titles from your site's RSS feed for friendly display
  6. Aggregates and displays analytics by essay, time period, etc.

Note: If you have many non-V4V transactions (Nostr zaps, podcast streaming, etc.), they fill up the cache but are filtered out of reports. Use v4v cache --rebuild to ensure complete history if payments seem missing.

Hugo Integration

Accept V4V payments on your Hugo site deployed to Netlify. This repo includes:

  • Netlify proxy - LNURL-pay edge functions for discovery, invoice generation, and status polling
  • Hugo template - Payment page with amount selection and QR codes
  • Theme-agnostic CSS - Customizable via CSS variables
# Quick start
cp -r proxy/netlify/* your-site/netlify/
cp -r hugo/layouts/v4v your-site/layouts/
cp hugo/assets/css/v4v.css your-site/assets/css/
npm install @getalby/sdk bolt11

See docs/HUGO_SETUP.md for complete setup instructions.

Development

npm test                   # Run tests
./bin/v4v dashboard --mock # Test dashboard with mock data

License

MIT

About

Accept Bitcoin Lightning payments on Hugo sites. Includes Netlify proxy, payment page template, and analytics CLI.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors