Monorepo for a multi-tenant Lightning + Nostr backend with SDK and embeddable widgets. Currently a scaffold; features are stubbed and ready to extend.
apps/api– Fastify API server (TypeScript, Prisma, OpenNode provider stub)apps/gallery– Demo app to exercise SDK/embed (Vite + React skeleton)packages/sdk– Typed client for the APIpackages/embed– Browser bundle and widgetspackages/config– Shared lint/tsconfigdeploy/azure– Bicep + GH Actions pipeline for Azure Container Apps
- Specs live in
specs/speckit/(constitution + embeddable comment/tip widget plan).
pnpm install
docker compose up -d postgres
cp apps/api/.env.example .env
pnpm dev # runs the API against Postgres on :5432Database migrations (Postgres):
DATABASE_URL=postgres://nostrstack:nostrstack@localhost:5432/nostrstack pnpm --filter api prisma migrate deploy --schema apps/api/prisma/pg/schema.prismaSeed demo tenant/user:
DATABASE_URL=postgres://nostrstack:nostrstack@localhost:5432/nostrstack pnpm --filter api seedDeploy: see deploy/azure/README.md and .github/workflows/azure-deploy.yml for Azure Container Apps pipeline.
- Staging pipeline:
.github/workflows/azure-deploy-staging.yml(deploys tonostrstack-api-stgwith optional Log Analytics).
Funding sources / LNbits:
- Switch providers via env:
LIGHTNING_PROVIDER=lnbitswithLN_BITS_URL,LN_BITS_API_KEY; default is OpenNode. - Local LNbits dev helper:
docker compose -f deploy/lnbits/docker-compose.yml up(exposes :5000).
Observability:
- Prometheus metrics at
/metrics(per-tenant labels), enabled by default. - OpenTelemetry traces/metrics optional: set
OTEL_ENABLED=trueandOTEL_EXPORTER_OTLP_ENDPOINT(plusOTEL_EXPORTER_OTLP_HEADERSif needed). Service name defaults tonostrstack-api.
Public Nostr event landing:
- View any event/profile/address at
https://nostrstack.com/nostr/<id>(local dev:https://localhost:4173/nostr/<id>). - Supported IDs: 64-char hex,
note,nevent,naddr,npub,nprofile(optionalnostr:prefix). - API:
GET /api/nostr/event/:idon the API server (local dev:https://localhost:3001/api/nostr/event/<id>).
Payments:
- Profile SendSats and zap flow notes:
docs/payments.md.
Find friend + tip flow:
- Open
/search(or “Find friend” in the sidebar) to resolvenpub,nprofile, hex pubkeys, ornip05. - Open the profile, zap posts, and send a 500-sat tip (enable
VITE_ENABLE_PROFILE_PAY=true). - Setup + troubleshooting:
docs/find-friend-tip.md.
-
See
docs/demo-modes.mdfor the three presets (regtest, mutinynet, mainnet) and one-liners. -
Quick regtest start:
pnpm demo:regtest # colima+docker required; API :3001, gallery :4173
- Use
pnpm dev:network -- --network regtest|mutinynet|mainnetto load.env.network.*profiles (sets BITCOIN_NETWORK/VITE_NETWORK + telemetry provider defaults). - For mutinynet/mainnet, set
LN_BITS_URL+LN_BITS_API_KEYand a matchingTELEMETRY_ESPLORA_URL(MAINNET_DEMO_OK=truerequired for mainnet).
See AGENTS.md for workflow conventions. Tasks and status: pnpm exec bd list.
-
Add a script/bundle for
@nostrstack/widgets, then drop:<div data-nostrstack-comment-tip="thread-or-slug" data-tip-username="alice" data-tip-item-id="post-123" data-tip-show-feed="false"> </div>
Use data-relays to override relays, data-tip-preset-amounts-sats for presets, and data-base-url/data-host to point at your API/tenant.