Documentation Index
Fetch the complete documentation index at: https://docs.spark.money/llms.txt
Use this file to discover all available pages before exploring further.
Breez is a fully featured Lightning SDK that lets developers add self-custodial Lightning and Spark payments to their apps with almost zero lift.
If you want to integrate LNURL, Lightning Addresses, or Nostr support, Breez gives you everything in one place. It also includes bindings for all major languages and frameworks, making it the easiest and most complete way to build on Lightning today.
Learn more ->
Features
The SDK is written in Rust with bindings for all major languages (JS, Kotlin, Swift, Go, Python, RN, Flutter, C#). Here’s how to integrate it in your app.
Installation
npm install @breeztech/breez-sdk-spark
Quick Integration
When developing a browser application, import from @breeztech/breez-sdk-spark/web. You must initialize the WebAssembly module with await init() before making any other calls.import init, {
initLogging,
defaultConfig,
SdkBuilder,
} from "@breeztech/breez-sdk-spark/web";
// Initialise the WebAssembly module
await init();
When developing a Node.js application (v22+), import from @breeztech/breez-sdk-spark/nodejs.const {
initLogging,
defaultConfig,
SdkBuilder,
} = require("@breeztech/breez-sdk-spark/nodejs");
const { Command } = require("commander");
require("dotenv").config();
class JsLogger {
log = (logEntry) => {
console.log(
`[${new Date().toISOString()} ${logEntry.level}]: ${logEntry.line}`
);
};
}
const fileLogger = new JsLogger();
class JsEventListener {
onEvent = (event) => {
fileLogger.log({
level: "INFO",
line: `Received event: ${JSON.stringify(event)}`,
});
};
}
const eventListener = new JsEventListener();
const program = new Command();
const initSdk = async () => {
// Set the logger to trace
await initLogging(fileLogger);
// Get the mnemonic
const mnemonic = process.env.MNEMONIC;
// Connect using the config
let config = defaultConfig("regtest");
config.apiKey = process.env.BREEZ_API_KEY;
console.log(`defaultConfig: ${JSON.stringify(config)}`);
let sdkBuilder = SdkBuilder.new(config, {
type: "mnemonic",
mnemonic: mnemonic,
});
sdkBuilder = await sdkBuilder.withDefaultStorage("./.data");
const sdk = await sdkBuilder.build();
await sdk.addEventListener(eventListener);
return sdk;
};
program
.name("breez-sdk-spark-wasm-cli")
.description("CLI for Breez SDK Spark - Wasm");
program.command("get-info").action(async () => {
const sdk = await initSdk();
const res = await sdk.getInfo({});
console.log(`getInfo: ${JSON.stringify(res)}`);
});
program.parse();
Documentation