Skip to main content

Vibe Code An Application To Send And Receive Lightning Payments With Rizful

Want to build Lightning-powered applications without getting lost in the weeds? With Rizful test vaults and Nostr Wallet Connect (NWC), you can point your favorite AI coding assistant at a working example and let it help you build something awesome.

This guide shows you how to set up everything you need to vibe code Lightning payment functionality into your applications.

What is Vibe Coding?

Vibe coding is a development approach where you use AI coding assistants (like Claude Code, GitHub Copilot, or Cursor) to rapidly build applications. You describe what you want, point the AI at relevant examples, and iterate quickly. With the right setup, you can build Lightning-enabled apps in minutes.

Prerequisitesโ€‹

Before you start vibe coding, you'll need:

  1. Two test Rizful vaults with NWC codes (one for sending, one for receiving)
  2. Docker and Docker Compose installed on your machine
  3. An AI coding assistant (Claude Code, Cursor, GitHub Copilot, etc.)

Step 1: Set Up Test Rizful Vaultsโ€‹

First, create dedicated test vaults to experiment with. This keeps your main funds safe while you learn and build.

๐Ÿ‘‰ Safely Set Up Test Rizful Vaults with NWC โ€” Create isolated vaults with small balances for testing

Create two vaults:

  • One for sending payments (fund this one with ~100 sats)
  • One for receiving payments

Step 2: Get NWC Codes for Both Vaultsโ€‹

Next, generate send-and-receive NWC codes for each of your test vaults.

๐Ÿ‘‰ Get A Send & Receive NWC Code from Rizful โ€” Learn how to create NWC codes that allow apps to send and receive payments

You'll need two NWC codes:

  • NWC_CODE_SENDER โ€” from your sending vault
  • NWC_CODE_RECEIVER โ€” from your receiving vault

Step 3: Test Your NWC Codes (Optional)โ€‹

Before diving into code, you can verify your NWC codes work using the Alby Sandbox. This is a great way to understand how NWC works without writing any code.

Using Alby Sandboxโ€‹

  1. Visit sandbox.albylabs.com
  2. Click on Payment Notifications in the sidebar
  3. Paste your sender NWC code into the "Alice" connection field
  4. Paste your receiver NWC code into the "Bob" connection field
  5. Click Connect on both
Enter your two NWC codes to test payment notifications
Enter your two NWC codes to test payment notifications

Now you can experiment with:

  • โšก Payment Notifications โ€” See real-time notifications when payments are sent/received
  • ๐Ÿ’ธ Simple Invoice Payment โ€” Create and pay invoices
  • ๐Ÿ” Lookup Invoice Status โ€” Check payment statuses
  • ๐Ÿ“Š Balance Chart โ€” Monitor wallet balances

Step 4: Point Your AI at the Example Repositoryโ€‹

Ready to build? Point your AI coding assistant at this repository:

๐Ÿ‘‰ github.com/MegalithicBTC/rizful-lightning-vibe-code-example

This repository contains a minimal, working example that:

  • Connects to two Lightning wallets via NWC
  • Subscribes to payment notifications on both wallets
  • Creates a 1 sat invoice from the receiver
  • Pays the invoice from the sender
  • Displays the notifications received by both wallets

Quick Start with the Exampleโ€‹

# Clone the repository
git clone https://github.com/MegalithicBTC/rizful-lightning-vibe-code-example.git
cd rizful-lightning-vibe-code-example

# Create your secrets file
cp secrets.env.example secrets.env

Add Your NWC Codesโ€‹

Edit secrets.env and add your two NWC connection strings:

NWC_CODE_SENDER=nostr+walletconnect://...
NWC_CODE_RECEIVER=nostr+walletconnect://...

Run the Demoโ€‹

docker compose up --build

You should see output showing:

  • โœ… Both wallets connecting
  • ๐Ÿ“ Invoice creation
  • ๐Ÿ’ธ Payment being sent
  • ๐Ÿ”” Notifications from both sender and receiver
  • ๐Ÿ’ฐ Updated balances

Step 5: Start Vibe Coding!โ€‹

Now that you have a working example, you can ask your AI assistant to help you build features. Here are some prompts to try:

Simple Promptsโ€‹

  • "Modify this app to send 10 sats instead of 1 sat"
  • "Add a loop that sends 1 sat every 30 seconds"

Intermediate Promptsโ€‹

  • "Create a web server that displays the current balance"
  • "Add logging to a file for all payment notifications"

Advanced Promptsโ€‹

  • "Build a web interface that shows a QR code for the receiver's Lightning address and displays confetti when a payment arrives"
  • "Create a payment forwarding feature that automatically sends received payments to another address"
  • "Build a Lightning-powered tip jar with a leaderboard"

What You Can Buildโ€‹

With Rizful NWC codes and vibe coding, you can build:

Application TypeDescription
โšก Tip JarsAccept Lightning payments with real-time notifications
๐Ÿค– Payment BotsAutomate payments based on triggers or schedules
๐Ÿ“Š DashboardsMonitor wallet balances and transaction history
๐ŸŽฎ GamesMicropayment-enabled gaming experiences
๐Ÿ›’ E-commerceAccept Bitcoin payments in your apps
๐Ÿ”” Notification SystemsReact to incoming/outgoing payments

Resourcesโ€‹


Security Reminder: Protect Your NWC Codes!

The only dangerous part of this setup is your NWC codes. These codes give applications the ability to send payments from your vault.

  • ๐Ÿ” Never commit NWC codes to version control โ€” Use .gitignore to exclude your secrets.env file
  • ๐Ÿšซ Never share NWC codes publicly โ€” Treat them like passwords
  • ๐Ÿงช Use test vaults with small balances โ€” Limit your exposure while experimenting
  • ๐Ÿ—‘๏ธ Delete NWC codes when done โ€” Remove unused connections from your Rizful vault

If you can avoid leaking your NWC codes, you're good! The example repository is already set up with a .gitignore that excludes secrets.env, so your codes won't accidentally get committed.