A private, stateless Nostr relay optimized for Nostr Wallet Connect (NIP-47) on Cloudflare Workers.
According to legend, the phenomena of lightning and thunder are produced by the flashing of Manimekhala's crystal ball.
Mekhala is a specialized, ephemeral Nostr relay built in TypeScript. It acts as a private, zero-persistence communication bridge between Lightning wallet applications (e.g. Alby, Amethyst) and your wallet node:
- 100% Stateless: No event history or database storage. All events are routed instantly in-memory.
- WebSocket Hibernation: Uses Cloudflare Durable Objects to hibernate idle connections, waking up seamlessly when new events arrive to save resources.
- Strictly Specialized: Only routes NWC-related event kinds (
13194,23194-23197). Social and generic Nostr events are rejected.
- Fork & Deploy:
- Fork this repository to your GitHub account.
- Connect it to your Cloudflare Dashboard via Workers & Pages -> Create application -> Connect to Git and deploy.
- Configure Private Path:
- Under your Worker's Settings -> Variables and Secrets, add a Secret named
RELAY_SECRET. - Set it to a long, secure, unique path identifier.
- Under your Worker's Settings -> Variables and Secrets, add a Secret named
- Connect Your Wallet:
- Your Relay URL:
wss://your-worker.workers.dev/<your-secret-path>
- Your Relay URL:
Warning
Lightning Address Bridge (Experimental): The feature to bridge Lightning Addresses (e.g., you@domain.com) to NWC is highly experimental, under development, and not yet ready for production or general use.
Configurable via wrangler.toml or environment variables:
| Variable | Default | Description |
|---|---|---|
RELAY_SECRET |
None | Optional secret path parameter for private routing. |
WALLET_REGION |
apac |
Physical DO location (apac, weur, wnam). |
MAX_CONNECTIONS |
100 |
Max concurrent WebSocket connections per DO. |
MAX_CONTENT_LENGTH |
65536 |
Max Nostr event size in bytes (16KB to 64KB recommended). |
- Type-check:
npx tsc --noEmit - Local Dev:
npx wrangler dev(Runs locally on port8787) - Integration Tests:
./scripts/test.sh(Runs type-check, starts DO, runs Node.js checks)
- No panics: Always use
?or proper error handling. - Safe indexing: Use
.get()for array/slice access. - Storage state: Every subscription update must call
sync()to ensure active filters survive DO hibernation.
Mekhala is open-source software under the MIT License.