← Contract Hero · WorkLearnPlugins
deepbook-snippets
Sui · DeepBook V3 · reference apps

DeepBook is infrastructure,
not a product.

Four runnable, sandbox-tested reference apps for the most common DeepBook V3 integration patterns. You call the matching engine instead of rebuilding it — clone a snippet, run it against a local sandbox, and crib the SDK and Move calls into your own product.

A DeepBook order book: red asks above the mid price, green bids below, with depth bars sized by resting quantity. DEEP / SUI order book 0.02411,420 0.0240980 0.0239540 mid 0.02385 spread 0.0001 0.0238610 0.02371,050 0.02361,530 asks bids depth by resting quantity
the primitive you build on, not the one you rebuild
How to run

Every snippet runs end to end against a live sandbox

No mocks. Each app talks to a local deepbook-sandbox — real pools, a market maker, a faucet — and its test suite drives the actual SDK and Move calls on a local Sui chain.

Bring up the sandbox

Clone deepbook-sandbox and run pnpm deploy-all on Docker: pools, a market maker, a faucet.

Point at the manifest

Snippets read deployments/localnet.json for addresses; override with DEEPBOOK_SANDBOX_DEPLOYMENTS.

Run the tests

pnpm test funds a fresh keypair from the faucet per case and runs the pattern live.

Drive the UI

pnpm dev serves a minimal Vite smoke UI (ports 5181–5184) that calls the same core.

Quickstart

Clone, point at the sandbox, run

Bring up the sandbox once, then run any snippet's live tests or its dev UI. The tests are isolated — each funds a fresh ephemeral keypair from the faucet.

bash
# 1. bring up a local DeepBook sandbox (Docker)
git clone https://github.com/MystenLabs/deepbook-sandbox
cd deepbook-sandbox/sandbox && pnpm deploy-all --quick

# 2. clone the snippets and run one
git clone https://github.com/contract-hero/deepbook-snippets
cd deepbook-snippets/01-swap
pnpm install
pnpm test     # live, against the sandbox
pnpm dev      # minimal UI on :5181

Before you start

  • ›Node.js 18+ and pnpm
  • ›Docker running, for the deepbook-sandbox
  • ›The Sui CLI on your PATH
  • ›03-flash-loan also publishes a Move package — run its contracts/scripts/deploy.sh first

If your sandbox lives outside ~/workspace/deepbook-sandbox, set DEEPBOOK_SANDBOX_DEPLOYMENTS to its deployments/localnet.json. Each snippet's README has the full run steps.