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.
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.
Four integration patterns, end to end
Each snippet is a small, self-contained mini-app: a headless core, a minimal UI, and a live test suite. Each is a team choosing not to rebuild the matching engine.
Swap over the CLOB
Swap wallet coins straight over the book with no BalanceManager, guarded by a real minOut that reverts on chain.
Place & Manage Orders
Create a BalanceManager, place and cancel limit and market orders, then reconcile settled against owed balances.
Flash-Loan Arbitrage
Borrow with a FlashLoan hot potato and repay it in a single PTB through a Move module you publish on chain.
Market-Maker Bot
Quote both sides with a POST_ONLY grid from one BalanceManager, then stake DEEP to earn maker fee rebates.
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.
# 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-loanalso publishes a Move package — run itscontracts/scripts/deploy.shfirst
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.