Published

Feb 24, 2026

Category

Developer

Building a Lightning Paywall App in One Session with Replit AI

How Bitcoin's Lightning Network, Alby's developer tools, and Replit Agent make it possible for anyone to build apps, integrate payments, monetize content in minutes.

The Hello World of Bitcoin apps: A Paywall

Paywalls have been around since the early web, but they've always been painful. Traditional paywalls require accounts, credit cards, payment processors, KYC checks, and weeks of integration work. Want to sell a recipe for $0.50? Good luck — Stripe takes $0.30 per transaction, and you need a business account to even get started. The friction kills the economics.

Bitcoin's lightning network flips this on its head. Lightning enables instant, borderless micropayments with near-zero fees. A payment of 50 sats (fractions of a cent) settles fast with no intermediary, no account creation, no credit card, and no minimum transaction amount.

The key enabling technology here is NWC (Nostr Wallet Connect), an open protocol that lets applications interact with a user's bitcoin lightning wallet programmatically. Instead of integrating with a payment processor, you just ask the user to paste their NWC connection string. That's it. No API keys, no merchant accounts, no approval process. 

This makes the app secure as it does not hold any keys and only has permission to receive payments.

What we, err replit's AI built: ZapWall

ZapWall is a web tool that lets anyone create bitcoin paywalls for any content in seconds. The flow is dead simple:

1. Connect your lightning wallet by pasting an NWC URL

2. Create a paywall. Paste text, drop a link, write markdown, share a secret, or upload a file

3. Set a price in sats and get a shareable URL

4. Share it. Visitors see a preview, scan a lightning QR code, pay, and instantly unlock the content

No accounts. No sign-ups. No payment processor integration. The creator's wallet receives bitcoin directly. ZapWall supports six content types: plain text, markdown, links, images, files, and secrets/codes.

Under the hood, it's a React + Express + PostgreSQL application. Each paywall stores its NWC connection so invoices can be created on demand when visitors arrive. Payment verification happens through NWC's `lookupInvoice`. The app polls every few seconds until the lightning invoice is settled, then unlocks the content.

Prompting an AI Agent: What Actually Matters

Building ZapWall was a collaboration between me and Replit Agent. Here's what I learned about giving an AI agent the right instructions to build something real:

Be specific about the user flow, not the implementation. I described what the user experiences: "paste an NWC URL, create a paywall, get a link, visitors pay to unlock." The agent figured out the database schema, API routes, and component architecture on its own.

Name the key constraints. The most important instruction was about security: content must never be sent to the client before payment is verified. This one sentence shaped the entire API design — the agent built a gated content endpoint that requires both a session token and payment hash.

Specify the ecosystem. Saying "use NWC" and "use @getalby/sdk" told the agent exactly which tools to reach for. AI agents work best when you point them at the right libraries rather than asking them to figure out the payment integration landscape.

Trust the agent on architecture. I didn't specify "use Drizzle ORM" or "create a polling mechanism for payment verification." The agent chose the right tools and patterns for the stack. The best prompts focus on *what* and *why*, not *how*.

Iterate on the real issues. When I asked to persist the NWC connection on the paywall record instead of an in-memory cache, the agent migrated the schema, updated every route, stripped the sensitive URL from all API responses, and verified with end-to-end tests — all in one pass.

The Alby Skill: Lightning Development Made Accessible

A major reason this build went smoothly is Alby's developer ecosystem. Alby provides the `@getalby/sdk` package, which wraps the complexity of NWC into clean, simple methods:

- NWCClient.makeInvoice() — create a lightning invoice in one line

- NWCClient.lookupInvoice() — check if an invoice has been paid

That's the entire payment integration. No webhook endpoints. No callback URLs. No payment processor dashboards. The SDK handles connecting to Nostr relays, signing NIP-47 requests, and communicating with the wallet.

For AI agents specifically, the Alby SDK is a gift. The API surface is small, well-typed, predictable and available as the Alby Bitcoin Payments Agent skill. When you tell an agent "use @getalby/sdk for NWC wallet operations," or just npx skills add getAlby/alby-agent-skill it knows exactly what to do. There's no maze of configuration options or authentication flows to navigate.

Replit Agent: The Perfect Building Partner

Here's what made Replit Agent the ideal partner for this project:

It handles the full stack. Database schema, Express routes, React components, Tailwind styling, dark mode, QR code generation. The agent built all of it in a single session. No context switching between tools.

It tests its own work. After every major change, the agent ran end-to-end tests using Playwright. It navigated to pages, clicked buttons, verified API responses and checked that sensitive data wasn't leaked. When we asked to persist NWC URLs, the agent didn't just update the code. It verified that nwcUrl was stripped from every single API endpoint's response.

It debugs from logs. When the WebSocket polyfill was missing, the agent read the server logs, identified the ReferenceError: WebSocket is not defined stack trace, installed the `ws` package, and applied the polyfill. It worked all without me having to diagnose anything.

It manages complexity so you don't have to. Schema migrations, cache invalidation, security hardening, type safety across the stack. These are the things that slow solo developers down. The agent handles them as part of its normal workflow.

It stays focused on shipping. The agent doesn't bikeshed on framework choices or suggest rewriting everything in Rust. It picks sensible defaults, builds incrementally, and delivers working software. That's the partnership: you bring the vision and domain knowledge, the agent brings the execution speed and technical depth.

The Future Is Lightning-Fast AI

We're at the beginning of something wild. The combination of bitcoin micropayments, open wallet protocols like NWC, and AI-powered development tools means that anyone with an idea can build and ship a monetized application in a single afternoon

Think about what that means. A journalist in Lagos can paywall an investigative report for 100 sats. A developer in Buenos Aires can sell code snippets for 10 sats each. A grandmother in rural Montana can monetize her blue-ribbon cake recipe for 50 sats and every satoshi goes straight to her wallet, instantly, with no middleman.

The barriers to building and monetizing on the internet have never been lower. The tools are here. The network is live. The only thing missing is you.

Go build something.

---

ZapWall is open source and built on Replit. Connect any NWC-compatible wallet and create your first paywall in under a minute.