balatro-seed-search/server
Julie 3aeb69a8ef Initial scaffold: Rust engine + WASM + web/server skeleton
Engine (Rust → WASM):
- pseudohash + LuaJIT-compatible PRNG (LCG with tausworthe step)
- Per-run instance cache (get_node_child ported from Immolate)
- Item tables for all 12 categories (60 common jokers, 5 legendaries, etc.)
- Source derivations: next_joker, next_tag, next_voucher, next_boss
- Filter DSL with bytecode compiler and 5 clause kinds
- WASM bundles: scalar (135KB) and SIMD-enabled (147KB)
- 14/14 tests passing; native throughput 552k seeds/sec with real derivations

Web:
- Vite + React + TypeScript scaffold
- COOP/COEP headers for SharedArrayBuffer
- Engine loader + worker stubs ready for milestone 2

Server:
- Optional Node.js WebSocket worker (off by default per user request)
- Dockerfile + README with honest cloud-speedup math

Built from scratch in one session — no Balatro source code reused.
2026-06-28 21:24:57 +00:00
..
src Initial scaffold: Rust engine + WASM + web/server skeleton 2026-06-28 21:24:57 +00:00
Dockerfile Initial scaffold: Rust engine + WASM + web/server skeleton 2026-06-28 21:24:57 +00:00
README.md Initial scaffold: Rust engine + WASM + web/server skeleton 2026-06-28 21:24:57 +00:00
package-lock.json Initial scaffold: Rust engine + WASM + web/server skeleton 2026-06-28 21:24:57 +00:00
package.json Initial scaffold: Rust engine + WASM + web/server skeleton 2026-06-28 21:24:57 +00:00

README.md

Balatro Seed Searcher — Optional Cloud-Boost Server

This is an OPTIONAL cloud-boost adapter. The seed searcher works fully offline in your browser without this server. You do not need to run this at all for normal use.

What it does

This is a tiny Node.js WebSocket server that accepts seed-scan requests from the web UI and runs them using a native engine binary (compiled from the engine/ Rust crate). Because it runs natively on the server's CPU rather than inside the browser's WebAssembly sandbox, it can be faster for large searches.

How to run it

cd server
npm install
npm start

The server starts on port 8787 by default.

To use a different port:

PORT=9000 npm start

For development with auto-restart on file changes:

npm run dev

Pointing the web UI at the server

In the web UI settings (or via the cloudServerUrl option), enter:

ws://localhost:8787

or, if running on a remote host:

ws://your-server-hostname:8787

The UI will fall back to its built-in WASM engine automatically if the WebSocket connection fails or is not configured.

Performance expectations (honest)

Environment Speedup vs browser WASM
Same desktop machine ~1–2× (marginal)
Free-tier cloud (Render / Fly / Railway) ~3–5× over a phone; ~1–2× over a desktop

Not worth paying for unless you regularly search for sub-1-in-1B criteria. For everyday use the browser WASM engine is fast enough.

Configuration

Environment variable Default Description
PORT 8787 WebSocket listen port
MAX_WORKERS 4 Max concurrent scan workers

Protocol

The server speaks a simple JSON WebSocket protocol:

Client → Server

{
  "type": "scan",
  "startRank": 0,
  "count": 10000,
  "filterJson": "{}",
  "seedLen": 8,
  "deckIdx": 0,
  "stakeIdx": 0,
  "partial": false,
  "minScore": 0
}

Server → Client

Message Meaning
{"type":"match","seed":"ABCD1234","rank":42,"score":87} A seed that passed filters
{"type":"progress","scanned":500} Heartbeat every ~100 ms
{"type":"done","scanned":10000} Chunk finished
{"type":"error","msg":"..."} Something went wrong

Native engine

The server tries to load the native engine binary at:

../engine/target/release/balatro-seed-engine

If it is not built yet, the server will respond with an error message but remain running. The src/worker.js stub emits placeholder data in the meantime so the protocol can be tested end-to-end.

To build the engine (requires Rust / Cargo):

cd engine
cargo build --release

Security

This server has no authentication. It accepts connections from anyone who can reach its port.

  • Local use only: run it on localhost and do not expose port 8787 to the internet.
  • Remote use: put it behind your own reverse proxy with TLS and an auth layer (e.g. Nginx + HTTP Basic Auth, Cloudflare Access, Tailscale, etc.) before exposing it publicly.

Docker

A minimal Dockerfile is included for containerised deployment:

docker build -t balatro-seed-server .
docker run -p 8787:8787 balatro-seed-server