# Ecosystem Builders

> Canonical: https://docs.velocity.exchange/developers/ecosystem-builders

This section is for teams building on top of Velocity rather than inside it: trading front ends, wallets, portfolio and analytics dashboards, indexers, and aggregator integrations. It assumes an application reading and writing Velocity state, not a keeper and not a market-making operation. For either of those, [Trading Automation](/developers/trading-automation.md) and [Market Makers](/developers/market-makers.md) are the sections to read.

Everything here runs through `@velocity-exchange/sdk`, which carries the `VelocityClient`, `User`, and `DLOB` classes along with the order and auction math and signed-message order construction. Three read and write paths cover almost every integration, and the pages below take one each.

## Setup

Every app starts the same way: construct a `VelocityClient`, subscribe it to onchain data, then read from its caches.

```ts
import { Connection } from "@solana/web3.js";
import { VelocityClient, Wallet, loadKeypair } from "@velocity-exchange/sdk";

const connection = new Connection("<RPC_URL>", "confirmed");
const wallet = new Wallet(loadKeypair("<KEYPAIR_PATH>")); // or a connected wallet-adapter wallet

const velocityClient = new VelocityClient({
  connection,
  wallet,
  env: "mainnet-beta",
});

await velocityClient.subscribe();
```

Once subscribed, account and market data are available synchronously from the subscriber caches, with no RPC round trip per read:

```ts
const state = velocityClient.getStateAccount();
const perpMarket = velocityClient.getPerpMarketAccount(0); // SOL-PERP
const user = velocityClient.getUser(); // active subaccount's User wrapper

const health = user.getHealth();               // 0-100
const totalCollateral = user.getTotalCollateral();
const perpPosition = user.getPerpPosition(0);
```

[SDK Setup](/developers/velocity-sdk/setup.md) has the full `VelocityClientConfig` reference, including polling versus websocket subscription modes and how to subscribe to a subset of markets and oracles. [Reading Data](/developers/ecosystem-builders/reading-data.md) covers the read paths, and [PnL & Risk](/developers/velocity-sdk/pnl-risk.md) the margin and health calculations.

## React apps

There is no Velocity React package. Wrap `VelocityClient` construction and its subscription lifecycle in a hook or provider, typically a `useEffect` that builds the client on wallet connect and calls `subscribe()` and `unsubscribe()` around it. Keep the derived state, positions, orders, and margin, in whatever state manager the app already uses.

## Staying current

- The SDK ships from `velocity-v1`, the monorepo holding the program, SDK, vaults, and keeper bots. It is not public yet, so track SDK breaking changes through the published `@velocity-exchange/sdk` releases.
- [Migration guide](/developers/migrate-from-drift.md): the behavioral and SDK differences to check when porting an existing integration.
- [Data API playground](/developers/data-api.md): try the REST endpoints against live data before writing a client.
