This repository contains a Rust Binance Futures grid-trading backend and a
React/TypeScript console. Backend code lives in src/: strategy/ implements
grid behavior, exchange/ handles Binance connectivity, server/ exposes
HTTP and WebSocket APIs, and db/ manages SQLite persistence. Integration
tests live in tests/; module-specific Rust tests also live alongside source.
The frontend lives in frontend/src/, organized into pages/, components/,
lib/, styles/, and test/. Supporting design documents are in docs/,
DESIGN.md, and PRODUCT.md.
Use Rust 1.89+ and Node.js 22.22.2+ (or 24.15.0+ / 26+).
cargo run --locked --release: start the backend with its default SQLite database.cargo test --locked: run Rust unit and integration tests.cargo clippy --locked --all-targets -- -D warnings: lint all Rust targets with warnings denied.cargo fmt --check: check Rust formatting; usecargo fmtto apply it.cd frontend && npm ci: install the locked frontend dependencies.cd frontend && npm run dev: start Vite; API requests proxy to127.0.0.1:8080by default.cd frontend && npm run lint: run ESLint (TypeScript and React Hooks rules, includingexhaustive-deps, enforced as errors).cd frontend && npm test: run the Vitest suite.cd frontend && npm run build: type-check and build the production console.docker compose up -d --build: build and start both services.
Follow rustfmt defaults for Rust (four-space indentation and snake_case
functions and modules). Frontend files use TypeScript, two-space indentation,
single quotes, and semicolons; use PascalCase for React components and
camelCase for functions and variables. Preserve existing UI patterns and
Chinese user-facing copy. Use decimal types for prices and quantities rather
than introducing floating-point trading calculations.
Keep Telegram and ntfy notifications in sync. When changing notification content, layout, fields, or trigger behavior, update both channels and their relevant tests together unless the user explicitly requests a channel-specific change. Preserve each channel's supported formatting.
Add focused tests for behavior changes, particularly order reconciliation,
trading safety, persistence, and API responses. Rust uses built-in tests and
integration files named *_test.rs or *_tests.rs. Frontend tests use Vitest
and Testing Library in frontend/src/test/, named *.test.ts or
*.test.tsx. Run the relevant suite and frontend build before submitting.
Recent commits commonly use Conventional Commit prefixes such as feat,
fix, and optional scopes, for example fix(frontend): prevent account title flicker. Keep commits focused and write imperative summaries. Pull requests
should describe the behavior change, relevant validation, and any trading or
migration implications; link related issues and include screenshots for
visible UI changes.
Never commit API keys, Telegram tokens, or SQLite databases. Runtime settings and credentials are stored in SQLite and managed through the console; use paper trading for development. Preserve existing safeguards around live orders, pause state, and exchange reconciliation.