A Next.js copy trading bot for Hyperliquid perpetual futures. It monitors configured copy wallets and can replicate trades proportionally from the dashboard-managed bot wallet configuration.
This software trades real money with leverage. Use it at your own risk.
- Perpetual futures are high risk. You can lose your entire deposit, and losses can exceed your initial margin. Nothing here is financial advice.
- The bot holds a private key with full trading and withdrawal authority over the wallet you give it. It is encrypted at rest, but anyone who gains access to the host and
ENCRYPTION_KEYcontrols those funds. - There is no authentication on the dashboard or API routes by default. Do not expose it to the public internet. See docs/SECURITY.md.
- Copy trading replicates another wallet's positions. A profitable copy wallet does not make your results profitable — sizing, slippage, funding, and timing all differ.
Start on a throwaway wallet with an amount you are willing to lose entirely.
Use Docker Compose for Postgres, then run the Next.js app locally with Bun so hot reload and breakpoints work normally.
- Bun
- Docker Desktop or Docker Engine with Compose
bun install
cp .env.example .envGenerate an encryption key and set it in .env:
openssl rand -hex 32Start Postgres:
docker compose up -d postgresApply migrations and run the seed script:
bunx prisma migrate dev
bunx prisma db seedStart the app:
bun run devOpen http://localhost:3000, then create a bot from /bots/new with a private key and copy wallet address. Private keys are encrypted before being stored in Postgres.
docker compose up -d postgres
bun run devUseful commands:
bun run lint
bun run test
bun run build
bunx prisma studioTo stop local services:
docker compose downTo remove the local database volume and start from a clean database:
docker compose down -vFor a production-like container run, apply migrations first, then start the container profile:
docker compose up -d postgres
bunx prisma migrate dev
docker compose --profile container up --build appThe containerized app listens on http://localhost:3006.
The default .env.example DATABASE_URL points at the Compose Postgres service from the host:
DATABASE_URL=postgresql://copy_trade_bot:copy_trade_bot@localhost:5432/copy_trade_botRequired values:
DATABASE_URLENCRYPTION_KEY
Optional values:
PORTNEXT_MANUAL_SIG_HANDLE
See ARCHITECTURE.md and the docs in docs/ for the runtime and product details.