Skip to content

feat(extensions): add modular extension loader infrastructure#904

Closed
PatMulligan wants to merge 4 commits into
shocknet:masterfrom
PatMulligan:feat/extension-loader
Closed

feat(extensions): add modular extension loader infrastructure#904
PatMulligan wants to merge 4 commits into
shocknet:masterfrom
PatMulligan:feat/extension-loader

Conversation

@PatMulligan

@PatMulligan PatMulligan commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a modular extension system for adding functionality to Lightning.Pub without modifying core code
  • Extension Loader discovers, loads, and manages extension lifecycle with health checks and graceful shutdown
  • Each extension gets an isolated SQLite database (better-sqlite3, WAL mode) with migration tracking
  • Extensions can create invoices, pay invoices, send Nostr DMs, register RPC methods, and subscribe to payment/Nostr events
  • Includes comprehensive documentation and extension authoring guide

Test plan

  • Extension loader discovers and loads extensions from configured directory
  • Extensions get isolated SQLite databases that persist across restarts
  • RPC methods registered by extensions are callable via Nostr transport
  • Deployed and running in production with LNURL-withdraw extension

@socket-security

socket-security Bot commented Mar 4, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​types/​better-sqlite3@​7.6.131001007181100

View full report

@PatMulligan PatMulligan force-pushed the feat/extension-loader branch from 915c044 to 98c2942 Compare March 4, 2026 19:18
PatMulligan and others added 4 commits March 4, 2026 15:13
Adds a modular extension system for Lightning.Pub that allows
third-party functionality to be added without modifying core code.

Features:
- ExtensionLoader: discovers and loads extensions from directory
- ExtensionContext: provides extensions with access to Lightning.Pub APIs
- ExtensionDatabase: isolated SQLite database per extension
- Lifecycle management: initialize, shutdown, health checks
- RPC method registration: extensions can add new RPC methods
- Event dispatching: routes payments and Nostr events to extensions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Covers architecture, API reference, lifecycle, database isolation,
RPC methods, HTTP routes, event handling, and complete examples.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Enables extensions to get LNURL-pay info for users by pubkey,
supporting Lightning Address (LUD-16) and zap (NIP-57) functionality.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Required for the extension database module which uses better-sqlite3.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shocknet-justin

Copy link
Copy Markdown
Member

Will continue review/testing here #907

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants