Skip to content

Repository files navigation

NostrBridge

License: PolyForm Noncommercial 1.0.0 Node.js Version pnpm Workspace

NostrBridge is a rule-based SaaS webhook transformer hosted on Cloudflare. It allows users to define custom HTTP webhooks (e.g., for GitHub releases, Stripe billing events, RSS feeds) that automatically ingest JSON payloads, format them using custom templates, cryptographically sign them as Nostr events, and publish them to configured Nostr relays.

Monetization is built directly into the protocol via zaps (NIP-57/LNURL-pay) where users pay-per-execution.


πŸ“œ Licensing & Usage Rights

NostrBridge is released under the PolyForm Noncommercial License 1.0.0.

  • Allowed: Personal self-hosting, non-commercial research, non-commercial education, private testing, and open-source contributions.
  • Prohibited: Commercial exploitation, running the software as a paid hosted service, or embedding it in a commercial SaaS product without express permission.

For details, read the full text in LICENSE.


πŸš€ Technology Stack

  • Monorepo Manager: pnpm workspace protocol
  • API (Hono on Cloudflare Workers): Low-latency edge router handles authentication, mapping engine, relay broadcasting, and zap verification.
  • Dashboard (Vite + React + TailAdmin): Single Page Application styled with TailAdmin UI & Tailwind CSS for rules setup, logs, and top-ups.
  • Marketing Site (Astro.js): Highly optimized static/SSR marketing site deployed to Cloudflare Pages.
  • Database & State Management:
    • Cloudflare D1: Relational SQL database for users, rules, log audits, and invoices.
    • Cloudflare KV: High-speed cache for rules lookup and credit balance validation.
    • Durable Objects: Rate-limiting and transient state coordination (e.g., NIP-46 socket coordination).
  • Nostr Integration: nostr-tools for cryptographic signing, NIP-98 authentication, and connection pooling to relays.

πŸ“‚ Repository Structure

The codebase is organized as a monorepo workspace under the following directory layout:

nostrbridge/
β”œβ”€β”€ .github/             # Issue & PR templates, community workflows
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ api/             # Hono App on Cloudflare Workers
β”‚   β”‚   β”œβ”€β”€ src/         # API Endpoint routers and handler logic
β”‚   β”‚   β”œβ”€β”€ migrations/  # D1 Database SQL migration files
β”‚   β”‚   └── wrangler.toml# Cloudflare Workers configuration
β”‚   β”œβ”€β”€ dashboard/       # React SPA
β”‚   β”‚   β”œβ”€β”€ src/         # Dashboard pages, forms, and logs components
β”‚   β”‚   └── package.json # Dashboards build dependencies
β”‚   └── landing/         # Astro.js Marketing Site
β”‚       β”œβ”€β”€ src/         # Astro page templates and documentation guides
β”‚       └── package.json # Astro build configuration
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ shared/          # Types, interfaces, and Zod schemas shared across apps
β”‚   β”œβ”€β”€ nostr/           # Event signers, decryptors, and relay broadcasting wrappers
β”‚   └── config/          # Shared tsconfigs, tailwind configurations, and ESLint settings
β”œβ”€β”€ CONTRIBUTING.md      # Developer guide & Supervised AI policy
β”œβ”€β”€ CODE_OF_CONDUCT.md   # Contributor Covenant v2.1
β”œβ”€β”€ SECURITY.md          # Security policy & vulnerability reporting
β”œβ”€β”€ LICENSE              # PolyForm Noncommercial License 1.0.0
β”œβ”€β”€ package.json         # Workspace root package settings
β”œβ”€β”€ pnpm-workspace.yaml  # Workspace configuration defining app boundaries
└── .nvmrc               # Node.js target environment configuration

πŸ› οΈ Local Development Setup

1. Prerequisites

  • Node.js: v20.x (check configuration using .nvmrc)
  • Node Version Manager (nvm)
  • Package Manager: pnpm (v8 or later recommended)
  • Cloudflare Wrangler CLI: Installed globally or run via pnpm (wrangler)

2. Installation & Workspace Bootstrapping

Clone the repository and install all workspace dependencies:

# Ensure you are using the correct Node.js version
nvm use

# Install dependencies and link local workspace packages
pnpm install

3. Database Initialization (Cloudflare D1)

Set up your local SQLite database migrations using Wrangler:

# Verify Node version and run migration scripts
nvm use
pnpm --filter api wrangler d1 migrations apply DB --local

4. Running the Development Servers

Start the Hono API, React Dashboard, and Astro Marketing Site concurrently:

# Run all dev servers in parallel
nvm use
pnpm dev
  • API Dev Server: http://localhost:8787
  • Dashboard SPA: http://localhost:5173
  • Marketing Landing Page: http://localhost:4321

🏠 Self-Hosting Instructions

NostrBridge is designed to be easily self-hosted for personal use on your own Cloudflare account.

Step 1: Cloudflare Account Setup

  1. Create a free Cloudflare Account.
  2. Install & authenticate Wrangler CLI:
    nvm use
    nvm exec pnpm wrangler login

Step 2: Provision Cloudflare Resources

Create your D1 database and KV namespace:

nvm use
# Create D1 Database
pnpm --filter api wrangler d1 create nostrbridge-db

# Create KV Namespace
pnpm --filter api wrangler kv:namespace create CACHE_KV

Update apps/api/wrangler.toml with the returned database_id and kv_namespace id.

Step 3: Run Database Migrations

Apply D1 schema migrations to your remote database:

nvm use
pnpm --filter api wrangler d1 migrations apply DB --remote

Step 4: Configure Production Secrets

Set secrets required for encryption and authentication:

nvm use
pnpm --filter api wrangler secret put ENCRYPTION_KEY
pnpm --filter api wrangler secret put JWT_SECRET

Step 5: Deploy Edge Services

Deploy the API Worker and frontend apps:

nvm use
# Deploy API Worker
pnpm --filter api wrangler deploy

# Deploy Dashboard SPA to Cloudflare Pages
pnpm --filter dashboard build
pnpm --filter dashboard wrangler pages deploy dist/ --project-name=nostrbridge-dashboard

βš™οΈ Environment Variables & Secrets Reference

API Local Secrets (apps/api/.dev.vars)

Create this file locally for local development. Never commit it to git.

# AES encryption key (32 bytes base64/hex) to encrypt stored keys at rest
ENCRYPTION_KEY="your-super-secret-256-bit-aes-encryption-key"

# Secret token signing key for JWT issuance
JWT_SECRET="your-jwt-auth-signing-secret"

🀝 Community & Contributing

We welcome contributions! Please review our community guidelines before opening an issue or Pull Request:

  • CONTRIBUTING.md: Developer setup, code standards, and Supervised AI Policy (NO VIBE CODE).
  • CODE_OF_CONDUCT.md: Community standards and behavior.
  • SECURITY.md: Vulnerability reporting and cryptographic security guidelines.

πŸ€– Supervised AI Policy (NO VIBE CODE)

NostrBridge permits AI-assisted contributions under strict human supervision:

  • No Vibe Coding: Blindly submitting unreviewed, untested AI-generated code is strictly prohibited.
  • Every function must be reviewed, tested with unit tests (pnpm test), and fully understood by the submitter.

πŸ“„ License

This project is licensed under the terms of the PolyForm Noncommercial License 1.0.0. See the LICENSE file for details.

About

Bridge Any Webhook to Nostr Relays in Seconds Transform GitHub releases, Stripe payments, RSS feeds, and custom HTTP payloads into cryptographically signed Nostr events delivered at sub-second edge speed.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages