BITCONNECT
checking…

One connection upstream.
Any number downstream.

A read-only SpacetimeDB relay holding a live replica of BitCraft's public state. Point the stock spacetimedb-sdk or your generated bindings at this host instead of upstream, change nothing else, and get the same data — without adding load to the game servers.

01Connect

Pick a module, subscribe, and the SDK maintains a local cache exactly as it would against upstream. No BitCraft token is needed — the relay issues its own identities; upstream never sees your clients.

import { DbConnection } from './module_bindings';

DbConnection.builder()
  .withUri('wss://relay.example.com')   // ← the only change
  .withDatabaseName('idc-8')
  .onConnect((conn) => {
    // An event table: each row arrives once, as an insert, and is never cached.
    conn.db.marketTradeEvent.onInsert((_ctx, trade) =>
      console.log(`${trade.quantity} × item ${trade.itemId} at ${trade.unitPrice}`));

    conn.subscriptionBuilder()
      .onApplied(() => console.log('local cache ready'))
      .subscribe([
        'SELECT * FROM player_state',
        'SELECT * FROM market_trade_event',
      ]);
  })
  .build();
shell · bindings from this relay · spacetime cli 2.x
curl -s 'https://relay.example.com/v1/database/idc-8/schema?version=10' \
  | jq '{V10: .}' > bitcraft.json
mkdir -p spacetimedb    # the CLI wants a module dir, even with --module-def
spacetime generate --lang typescript --module-def bitcraft.json \
  --out-dir src/module_bindings      # --lang rust for the Rust SDK

Already on 1.x bindings, such as the community ones? Point them here unchanged: rows arrive as they do from upstream. Event tables need a 2.x SDK.

shell · poke it first
curl https://relay.example.com/v1/ping
curl 'https://relay.example.com/v1/database/idc-8/schema?version=9' | jq '.tables | length'

02Live events

BitCraft records what just happened (a trade, a craft, a swing) in event tables: each row reaches subscribers once and is never stored. Below is a protocol-v2 client in plain JavaScript, no SDK, subscribed through this relay to every event table of the module picked above.

starts when visible

Events per second

    03Surface

    The relay speaks SpacetimeDB's HTTP API and its v1, v2 and v3 WebSocket protocols, so existing tooling works unmodified.

    GET/v1/database/{module}/subscribeWebSocket — the SDK connects here
    GET/v1/database/{module}/schemaModule schema, as upstream publishes it · ?version=9 or 10
    GET/v1/database/{module}Database info
    POST/v1/identityRelay-local identity, no account required
    GET/v1/pingLiveness
    GET/healthzReady once every replica holds data

    04Semantics worth knowing

    Read-only

    Subscriptions and SQL over the replicated tables. Reducer calls are refused — this is a window into the world, not a way to act on it.

    Stale, never wrong

    If upstream drops, connected clients keep a consistent snapshot while the relay reconnects, rather than being cut off mid-session.

    Explicit refusals

    Tables excluded from replication error at subscribe time. You will never mistake "not replicated here" for an empty result.

    BITCONNEEEEEECT
    hey hey hey · bitconneeeect