GunX gunx.pages.dev

Serverless GunDB for everyone

Connect any app to a free, always-on GunDB relay. No relay server to run, no backend to deploy — realtime P2P sync, offline-first storage, and SEA end-to-end encryption, powered by Cloudflare Workers + Durable Objects.

connecting… nodes — peers —

Live P2P playground

room: gunx-playground/chat 0 online

Open this page in two tabs — messages appear in both in realtime through gunx.pages.dev. Images host on imgbb.com via the server-side proxy (key never leaves the server); other files transfer P2P between tabs over WebRTC — any size, no limits (adaptive 64KB–256KB chunks, signaling through GunX souls).

How it works

  1. Your app connects wss://gunx.pages.dev/gun
  2. GunX namespaces your data with an appKey
  3. Puts are merged (LWW) into DO SQLite and relayed to peers live
  4. IndexedDB keeps you offline-first; auto-refresh re-syncs remote changes

Relay status

uptime
messages
bytes
backend

Direct Pair — zero-server WebRTC

no relay · no account · offline-capable

Host a pairing

Join a pairing

Nostr Mesh — public relay bridge

NIP-01 · Kind 30000 · no account

Bridge this playground through any public Nostr relay. Gun state is mirrored as Kind 30000 replaceable events signed with an ephemeral key — your chat data stays SEA-encrypted inside the event content, and every incoming event is Schnorr-verified before it touches the graph.

Any public relay works (try wss://relay.nostr.band, wss://nostr.wine). Open this page in two tabs, both connect to the same relay, and chat messages sync through the Nostr mesh — independently of the GunX relay.

Bridge status

disconnected
activity
sent 0 · recv 0
identity
key …

Why Nostr?

  1. #d tag = gun soul → replaceable per-soul state
  2. Relay replays latest state to late joiners (LWW)
  3. Kind 20000 heartbeat = peer discovery, no directory
  4. Full audit trail: every event is verifiable forever

Quickstart

Browser (script tag)

<script src="https://cdn.jsdelivr.net/npm/gun/gun.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gun/sea.js"></script>
<script src="https://cdn.jsdelivr.net/gh/OpenCodeWEB/GunX@main/public/gunx.js"></script>
<script>
  const gunx = GunX({ appKey: 'my-app' });
  gunx.get('todos').map().on((v, k) =>
    console.log('todo:', k, v));
  gunx.put('todos', { learn: 'GunX' });
</script>

Node / npm

const Gun = require('gun');
const GunX = require('./sdk/gunx.js'); // or your bundled copy

const gunx = GunX({ appKey: 'my-app' });

gunx.on('status', ({ status }) =>
  console.log('relay:', status));

gunx.get('todos').once(console.log);
gunx.put('todos', { hello: 'world' });

Why GunX

No relay server needed

The relay runs on Cloudflare Workers + Durable Objects (SQLite). Zero infrastructure to own, zero cost to start.

App namespacing

Every project gets an isolated appKey namespace — no key collisions on the shared relay.

Auto-refresh sync

The SDK re-asks the relay for subscribed souls, fixing GunDB's IndexedDB re-ask gap automatically.

Offline-first

IndexedDB/radisk persistence keeps your app fully functional offline; changes sync when you reconnect.

SEA encryption

End-to-end encryption with the Security-Encryption-Authorization module; SDK includes pair persistence helpers.

Rate-limited & public

Token-bucket rate limiting and 1 MB frame caps keep the shared relay fair for everyone. Live stats at /api/stats.