Jupiter Ultra Swap Demo
A single-page Solana swap UI demonstrating token swaps using Jupiter Ultra API

Overview
This Solana-based single-page application facilitates token exchanges through Jupiter Ultra API integration, paired with Quicknode RPC and Solana Wallet Adapter technologies. The application provides a seamless interface for users to swap tokens on the Solana blockchain with real-time balance updates and transaction tracking.
For a detailed walkthrough of the Jupiter Ultra API integration and implementation details, see the companion guide: How to Swap Tokens With Jupiter Ultra API.
Jupiter Ultra Swap is only available on Solana mainnet-beta. This means executing swaps will trade real tokens and incur real network fees. You could lose value due to price movement, slippage, or selecting the wrong token pair. Test with small amounts first.
Architectureβ
βββββββββββββββββββ
β Next.js UI β
β (Client Side) β
ββββββββββ¬βββββββββ
β
ββ Wallet Adapter (Phantom, Backpack, Solflare)
β
ββ API Routes (Server Side)
β ββ /api/tokens
β ββ /api/balances
β ββ /api/quote
β ββ /api/execute
β ββ /api/rpc
β
ββ Jupiter Ultra API
β ββ Token swaps & quotes
β
ββ Quicknode RPC
ββ Solana blockchain interactions
Featuresβ
- Multi-Wallet Support: Connect with Phantom, Backpack, or Solflare wallets
- Token Selection: Choose from a comprehensive list of verified Solana tokens for swap
- Real-Time Balances: View live token balances directly from the blockchain
- Swap Quotes: Get instant swap quotes before executing transactions
- Transaction Execution: Use Jupiter Ultra's Quote β Order β Sign β Execute β Status lifecycle
- Transaction Tracking: Monitor swap status and view transaction details on Solana Explorer
Prerequisitesβ
- Node.js (v18 or higher)
- A Quicknode Solana endpoint
- A Jupiter API key for swap functionality
- A Solana wallet (Phantom, Backpack, or Solflare) with mainnet access
- A small amount of mainnet-beta SOL for transaction fees
- A small amount of tokens to swap (USDC recommended for testing)
To get your Quicknode RPC URL:
- Sign up at Quicknode
- Create a new Solana endpoint
- Copy the HTTP Provider URL
Project Structureβ
jupiter-ultra-swap/
βββ app/
β βββ api/ # Server-side API routes
β β βββ balances/ # Token balance queries
β β βββ execute/ # Swap execution
β β βββ quote/ # Swap quotes
β β βββ rpc/ # RPC proxy
β β βββ tokens/ # Token list
β βββ providers/ # React context providers
β βββ globals.css # Global styles
β βββ layout.tsx # Root layout
β βββ page.tsx # Main swap interface
βββ components/ # Swap UI components
βββ hooks/ # Custom React hooks
β βββ useWallet.ts # Wallet connection logic
β βββ useTokens.ts # Token data management
β βββ useSwap.ts # Swap orchestration
βββ lib/ # Utility libraries
β βββ jupiter-client.ts # Jupiter API client
β βββ solana-kit.ts # Solana RPC client
β βββ types.ts # TypeScript definitions
βββ .env.example # Environment variables template
Getting Startedβ
1. Clone the repository:
git clone https://github.com/quiknode-labs/qn-guide-examples.git
cd qn-guide-examples/solana/jupiter-ultra-swap
2. Install dependencies:
npm install
3. Configure environment variables:
cp .env.example .env.local
Edit .env.local and add your Quicknode RPC URL and Jupiter API key.
# Quicknode Solana RPC endpoint
QUICKNODE_RPC_URL=your_quicknode_rpc_endpoint_here
# Jupiter API key for swap functionality
JUPITER_API_KEY=your_jupiter_api_key_here
4. Run the development server:
npm run dev
5. Open the application:
Navigate to http://localhost:3000 in your browser.
API Endpointsβ
The application includes the following server-side API routes:
/api/tokens: Returns the list of available tokens for swapping/api/balances: Fetches token balances for a connected wallet/api/quote: Gets swap quotes from Jupiter Ultra API/api/execute: Executes the swap transaction/api/rpc: Proxies RPC requests to Quicknode
Preview

- Fork the repository
- Create a feature branch:git checkout -b feature/amazing-feature
- Commit your changes:git commit -m "Add amazing feature"
- Push your branch:git push origin feature/amazing-feature
- Open a Pull Request.