Live demo: lightningconnect.lovable.app
Zero-friction Bitcoin wallet connection for any web app.
LightningConnect is a drop-in React widget + hook that solves wallet connection and automatic payment detection for Bitcoin web apps. Blink-native, universally compatible, and built so developers never write polling logic again.
- Blink-native β two dedicated Blink connectors (Address + API Key)
- Universally compatible β generic Lightning Address + NWC for every other wallet
- Auto payment detection β
onPaymentcallback fires once, automatically - Auto cleanup β watchers stop on PAID/EXPIRED and on unmount
- Light & dark mode β built-in theme toggle with persisted preference
- Encrypted local storage β device-bound via Web Crypto
- <30kb gzipped β only React as a peer dep
npm install lightningconnectimport { LightningConnect, useWalletConnect } from "lightningconnect";
export default function App() {
const { connect, isConnected, makeInvoice } = useWalletConnect({
onPayment: (invoice) => alert(`Paid: ${invoice.amount} sats`),
onExpiry: (invoice) => console.log("Expired", invoice.paymentHash),
});
return (
<>
<LightningConnect theme={{ primary: "#F7931A" }} />
{isConnected ? (
<button onClick={() => makeInvoice(1000, "BTC", "Coffee")}>
Get paid 1000 sats
</button>
) : (
<button onClick={connect}>Connect wallet</button>
)}
</>
);
}No setInterval, no useEffect, no cleanup. LightningConnect starts watching as soon as makeInvoice() resolves and fires onPayment exactly once when it settles.
LightningConnect groups its connectors into two categories β Blink (native, premium) and Other Wallets (universal compatibility).
| Category | Connector | Best for |
|---|---|---|
| Blink | Blink Lightning Address | Most users. Just a username, no setup. |
| Blink | Blink API Key | Power users. Full account control. |
| Other | βΏ Lightning Address | Any user@domain β WoS, Alby, Strike, etc. |
| Other | Nostr Wallet Connect (Beta) | Alby Hub, Zeus, Phoenix, Mutiny |
This repository contains two things:
/lightningconnect/β the npm package (source, tests, build config)/src/β the marketing site and live playground at lightningconnect.lovable.app
lightningconnect/
βββ src/
β βββ widget.tsx # <LightningConnect /> modal component
β βββ hooks/
β β βββ useWalletConnect.ts # Core hook with payment detection
β βββ connectors/ # Blink Address, Blink API, LNURL, NWC
β βββ lib/
β β βββ paymentWatcher.ts # Standalone watchPayment utility
β βββ index.ts # Public exports
βββ README.md # Full package docs
βββ package.json
βββ ...
src/
βββ routes/
β βββ index.tsx # Landing page + live playground
β βββ readme.tsx # Inline README viewer
βββ router.tsx
βββ ...
# Install dependencies
bun install
# Run tests
bun test
# Start dev server (site + playground)
bun run dev
# Build package
bun run build:libFull API documentation lives in lightningconnect/README.md and covers:
useWalletConnecthook API and callbackswatchPaymentstandalone utility- Connector details and setup instructions
- Theming (dark mode, light mode, custom overrides)
- Encrypted storage and export/import
- TypeScript types
MIT.