We created tutorials to help you get started with this project. Follow the steps in these tutorials to set up the frontend and backend, and start building your decentralized application.
- Backend Tutorial: Jupiter Swap Backend Tutorial
- Frontend Tutorial: Jupiter Swap Frontend Tutorial
Welcome to the Jupiter Swap API project, a Node.js-based backend service for performing token swaps on the Solana blockchain using the Jupiter aggregator. This API allows you to seamlessly swap tokens with low slippage and fast transactions, leveraging Solana’s high throughput.
- Token Swaps: Effortlessly swap tokens on the Solana blockchain.
- Jupiter Integration: Uses Jupiter, the ultimate aggregator, to get the best swap rates.
- Low Slippage: Default slippage of 0.5%, adjustable as needed.
- Solana Web3 Integration: Interacts directly with Solana's blockchain using
web3.js.
jupiter-swap-api/
│
├── app.js # Entry point of the application
├── controllers/
│ └── solana.controller.js # Handles the swap requests
├── routes/
│ ├── default.js # Default route handler
│ └── solana.js # Solana-related routes
├── services/
│ └── solana.service.js # Core logic for building swap transactions
├── .env # Environment variables (not included in version control)
├── package.json # Project metadata and dependencies
└── test.http # HTTP requests for testing the API- Node.js v14+ installed
- Yarn package manager
-
Clone the repository:
git clone https://github.com/yourusername/jupiter-swap-api.git cd jupiter-swap-api -
Install dependencies:
yarn install
-
Set up environment variables:
Create a
.envfile in the root directory with the following content:SOLANA_RPC_URL=https://api.mainnet-beta.solana.com JUPITER_QUOTE_API_URL=https://quote-api.jup.ag/v1/quote JUPITER_SWAP_API_URL=https://swap-api.jup.ag/v1/swap
-
Run the server:
yarn start
To perform a token swap, send a POST request to http://localhost:1337/solana/swap with the following JSON body:
{
"publicKey": "YourPublicKey",
"inputMint": "InputMintAddress",
"outputMint": "OutputMintAddress",
"amount": 0.01,
"slippage": 0.5
}Use the test.http file to test the API endpoints using an HTTP client like Postman or directly from VSCode.
We are Quantum Coders, the team behind this project. We are passionate about blockchain technology and its potential to revolutionize the world. Join us on our journey to build innovative solutions and contribute to the decentralized future.
Connect with us:
- Quantum Coders on X: @qcodersteam
- LunaAI on X: @lunadefiai
- Bonkhemist on X: @bonkhemist
- _0xJesus on X: @_0xjesus
We welcome contributions! If you’d like to contribute, fork the repository, create a feature branch, and submit a pull request. We look forward to collaborating with you.
This project is licensed under the MIT License. See the LICENSE file for more details.