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 (64KB 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

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.