What users can do
- Open long and short positions with adjustable leverage.
- Place market and limit orders, and set take profit and stop loss.
- Increase, partially close or close a position, adjust its margin and change its leverage.
- Cancel open orders.
- Deposit to and withdraw from their Hyperliquid account.
- See live prices, positions and account balance.
- Connect a wallet through WalletConnect.
Prerequisites
- A Yield.xyz API key with the Perps API enabled. The same project key works for the Earn, Perps and Borrow APIs.
- A Moralis API key, used to read wallet token balances.
- Optional: a Reown project ID for WalletConnect.
- Node.js 24 and pnpm 10, as pinned in the repository’s
mise.toml. pnpm 11 stops the install on unapproved build scripts, so use pnpm 10.
Run it locally
1
Clone and install
2
Set environment variables
Each app reads its own
.env. For the widget:packages/widget/.env
VITE_PERPS_BASE_URL, VITE_PERPS_API_KEY and VITE_MORALIS_API_KEY are required. VITE_REOWN_PROJECT_ID is optional.3
Start the dev server
Build and deploy
packages/widget/dist. Deploy it to any static host that serves single-page apps, with every path routed to index.html. The repository’s vercel.json configures this for Vercel. Set the environment variables in your host’s build settings, since they are read at build time.
Embed it
After you deploy the widget, embed it on your own domain with an iframe:How it works
The widget calls the Perps API athttps://perps.yield.xyz with your API key:
The Perps API guide walks through the same flow for teams that build their own interface.
Customize it
You can modify the source under the terms of its license:- Styling. The apps use Tailwind CSS v4. Change colors, fonts and spacing in the app styles and components.
- Features. Screens are file-based routes in
packages/widget/src/routes. Shared API clients, state and components are inpackages/common. - Wallets. Wallet connection uses Reown AppKit and wagmi, and is configured in the app’s context providers.
Troubleshooting
The widget does not load data
The widget does not load data
Check that
VITE_PERPS_BASE_URL, VITE_PERPS_API_KEY and VITE_MORALIS_API_KEY are set for the app you build, and that the key has the Perps API enabled. Variables are read at build time, so rebuild after changing them.Wallet connection fails
Wallet connection fails
Check your
VITE_REOWN_PROJECT_ID, that your domain is allowed in the Reown project, and that browser extensions are not blocking WalletConnect. Some wallet extensions do not inject into an iframe. Open the app in its own tab to compare.The install fails
The install fails
Use Node.js 24 and pnpm 10. With pnpm 11 the install stops on unapproved build scripts. To start over, delete
node_modules and run pnpm install again.Deep links return 404 after deploying
Deep links return 404 after deploying
Your host is not routing every path to
index.html. Add a single-page app rewrite, as in the repository’s vercel.json.License
The Perps widget is published under the Business Source License 1.1 (BSL-1.1), which converts to MIT on 2030-01-20. Read theLICENSE file in the repository before you deploy it.
Next steps
Perps dashboard
The full desktop trading terminal from the same repository.
Perps API guide
Build your own Perps interface on the same API.

