Skip to content
QSwapDocs

Quickstart

Run the QSwap API and app on your machine, against Jupiter and Solana mainnet. About 5 minutes.

QSwap is two programs: the API in backend/ (a small proxy in front of Jupiter and a Solana RPC) and the app in frontend/. You run both.

Your local setup
Browserlocalhost:3000
QSwap appfrontend/
NEXT_PUBLIC_API_URL
QSwap APIbackend/
Jupiterapi.jup.ag
Solana RPCmainnet-beta
QSwap API$ cd backend && bun run dev
QSwap app$ cd frontend && bun run dev

Without JUPITER_API_KEY the API calls Jupiter keyless, at 0.5 requests per second: enough for a look, not for use.

Start the API

Terminal 1
cd backend
cp .env.example .env   # JUPITER_API_KEY, SOLANA_RPC_URL
bun install
bun run dev

Get a Jupiter API key at developers.jup.ag. Without one the API runs keyless at 0.5 requests per second.

Point the app at it

Terminal 2
cd frontend
cp .env.example .env.local   # NEXT_PUBLIC_API_URL = the API's address
bun install

Start the app

Terminal 2
# http://localhost:3000 → /swap
bun run dev

This is mainnet

QSwap talks to Solana mainnet only. Quotes are free, but a swap you sign moves real funds. Try it with a small amount.

Env vars

The app reads one variable. Everything else (cluster, RPC URL, fees, slippage limits, feature flags) comes from GET /config.

Where settings come from
frontend/.env.local
  • NEXT_PUBLIC_API_URLrequired
backend/.env
  • SOLANA_RPC_URLrequired
  • JUPITER_API_KEYoptional
  • REFERRAL_ACCOUNToptional
  • REFERRAL_FEE_BPS50–255optional
GET /config
Everything else, at runtime
Cluster · mainnet-betaRPC URL · /rpcSlippage · auto · max 50%Referral fee · 0Feature flags · 1
Source: .env.example · GET /config

Check your work

The checks, in order
  1. 1Typesbun run typecheckAPI drift, wrong props
  2. 2Lintbun run lintHook misuse, dead code
  3. 3Formatbun run format:checkStyle noise in diffs
  4. 4Unit testsbun run testBroken maths and rules
  5. 5Buildbun run buildBroken pages and MDX
Source: package.json → scripts
bun run typecheck && bun run lint && bun run format:check && bun test && bun run build