2025-12-14 23:08:45 -03:00
2025-12-14 23:08:45 -03:00
2025-12-14 23:08:45 -03:00
2025-12-14 23:08:45 -03:00
2025-12-14 23:08:45 -03:00
2025-12-14 23:08:45 -03:00

LNPaywall

Turn any link into paid access in 60 seconds.

LNPaywall is a platform that lets creators monetize any URL with Lightning Network payments. Paste a link, set a price, share or embed, and get paid instantly.

LNPaywall

Features

  • 60 Second Setup - Paste a URL, set your price, start earning
  • Lightning Payments - Instant, low-fee Bitcoin payments
  • Embed Anywhere - Works with Webflow, WordPress, Framer, any website
  • No Custody - Funds go directly to your Lightning wallet
  • Works with Any Link - Notion, Google Docs, PDFs, videos, private pages

🚀 Quick Start

Prerequisites

  • Node.js 18+
  • PostgreSQL
  • Redis (optional, for sessions)
  • LNbits account (for payments)

Backend Setup

cd backend

# Install dependencies
npm install

# Set up environment variables
cp env.example .env
# Edit .env with your configuration

# Generate Prisma client and push schema
npm run db:generate
npm run db:push

# Seed demo data (optional)
npm run db:seed

# Start development server
npm run dev

Frontend Setup

cd frontend

# Install dependencies
npm install

# Set up environment variables
cp env.example .env
# Edit .env with your configuration

# Start development server
npm run dev

Access the app

Demo Accounts

After running the seed script:

📁 Project Structure

LNPaywall/
├── backend/
│   ├── src/
│   │   ├── config/         # Database and app configuration
│   │   ├── controllers/    # Route handlers
│   │   ├── middleware/     # Auth, logging, error handling
│   │   ├── models/         # Prisma schema
│   │   ├── routes/         # API routes
│   │   ├── services/       # Business logic
│   │   └── utils/          # Helpers and validation
│   ├── prisma/
│   │   ├── schema.prisma   # Database schema
│   │   └── seed.js         # Demo data seeder
│   └── env.example
├── frontend/
│   ├── src/
│   │   ├── components/     # Reusable UI components
│   │   ├── pages/          # Page components
│   │   ├── services/       # API client
│   │   ├── store/          # Zustand state management
│   │   └── styles/         # Global CSS
│   ├── public/
│   └── env.example
└── specs.md                # Full product specification

🔌 API Endpoints

Authentication

  • POST /api/auth/signup - Create account
  • POST /api/auth/login - Log in
  • POST /api/auth/logout - Log out
  • POST /api/auth/refresh - Refresh token
  • GET /api/auth/me - Get current user

Paywalls

  • POST /api/paywalls - Create paywall
  • GET /api/paywalls - List paywalls
  • GET /api/paywalls/:id - Get paywall
  • PATCH /api/paywalls/:id - Update paywall
  • POST /api/paywalls/:id/archive - Archive paywall

Checkout

  • POST /api/checkout/:paywallId - Create checkout session
  • GET /api/checkout/:sessionId - Get session
  • GET /api/checkout/:sessionId/status - Check payment status

Public

  • GET /p/:slugOrId - Public paywall page data
  • GET /embed/:id - Embed iframe

🔧 Configuration

LNbits Setup

  1. Create an LNbits wallet at https://legend.lnbits.com or self-host
  2. Get your Admin Key and Invoice/Read Key
  3. Add to your .env:
    LNBITS_URL=https://legend.lnbits.com
    LNBITS_ADMIN_KEY=your-admin-key
    LNBITS_INVOICE_KEY=your-invoice-key
    

Database

The app uses PostgreSQL with Prisma ORM. Update your DATABASE_URL in .env:

DATABASE_URL="postgresql://user:password@localhost:5432/lnpaywall"

📦 Embedding

Iframe Embed

<iframe 
  src="https://your-domain.com/embed/PAYWALL_ID" 
  width="100%" 
  height="400" 
  frameborder="0"
></iframe>

Button + Modal

<script 
  src="https://your-domain.com/js/paywall.js" 
  data-paywall="PAYWALL_ID" 
  data-theme="auto"
></script>

🛡️ Security

  • JWT-based authentication with refresh tokens
  • HTTPS-only URLs for paywalls
  • SSRF protection on URL fetching
  • Rate limiting on checkout creation
  • Device fingerprinting for access control
  • Signed access tokens

📈 Roadmap

  • Email receipts
  • Custom branding
  • Team accounts
  • Subscriptions
  • Analytics dashboard
  • Custom domains
  • BTCPay Server integration

📄 License

MIT License - see LICENSE file for details.

🤝 Contributing

Contributions are welcome! Please read the contributing guidelines first.


Built with for the Bitcoin ecosystem

Description
No description provided
Readme 29 MiB
Languages
JavaScript 98.5%
CSS 1.1%
HTML 0.4%