Skip to main content

Development Environment Setup

Get your development environment production-ready in 15 minutes
The right development setup determines whether you ship fast or struggle with configuration issues. This guide gets you from zero to first working Saros transaction in minimal time, with configurations optimized for each SDK.

πŸ› οΈ Development Setup Flow

Environment Configuration Process

Setup Verification Checklist

πŸš€ Quick Setup (5 Minutes)

Coming from SDK Selection? This guide will configure your environment for your chosen SDK. If you haven’t chosen yet, start with our SDK Selection Guide.

For TypeScript/JavaScript Developers

1

Install Node.js and Package Manager

# Using Node Version Manager (recommended)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
nvm install 18
nvm use 18

# Or download directly from nodejs.org
# Required: Node.js 16+ for Solana compatibility

# Choose your package manager
npm install -g pnpm  # Recommended for speed
# or use npm (built-in) or yarn
2

Install Solana CLI

# Install Solana CLI tools
sh -c "$(curl -sSfL https://release.solana.com/v1.16.0/install)"

# Add to PATH (add to ~/.bashrc or ~/.zshrc)
export PATH="/home/$USER/.local/share/solana/install/active_release/bin:$PATH"

# Verify installation
solana --version
3

Create Test Project

# Create new project
mkdir my-saros-app && cd my-saros-app
npm init -y

# Install Saros SDK (choose based on your needs)
npm install @saros-finance/dlmm-sdk @solana/web3.js
# OR: npm install @saros-finance/sdk @solana/web3.js

# Install TypeScript (optional but recommended)
npm install -D typescript @types/node

# Test installation
node -e "console.log('βœ… Saros development environment ready!')"

For Rust Developers

1

Install Rust Toolchain

# Install Rust (includes cargo)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh
source ~/.cargo/env

# Verify installation
rustc --version
cargo --version
2

Install Solana CLI

# Install Solana CLI tools  
sh -c "$(curl -sSfL https://release.solana.com/v1.16.0/install)"

# Add to PATH
export PATH="/home/$USER/.local/share/solana/install/active_release/bin:$PATH"

# Verify
solana --version
3

Create Test Project

# Create new binary project
cargo new my-saros-trading-bot --bin
cd my-saros-trading-bot

# Add Saros DLMM SDK to Cargo.toml
echo '[dependencies]
saros-dlmm = "0.1.0"
solana-client = "~1.16.0"
solana-sdk = "~1.16.0"
tokio = { version = "1", features = ["full"] }
anyhow = "1.0"' >> Cargo.toml

# Test build
cargo build
echo "βœ… Saros Rust environment ready!"

πŸ“‹ Complete Setup Guide

Prerequisites Checklist

Before starting, ensure you have:
  • Operating System: macOS, Linux, or Windows (with WSL2 recommended)
  • Internet Connection: Stable connection for downloading dependencies
  • Command Line Access: Terminal/Command Prompt familiarity
  • Text Editor: VS Code, Vim, or your preferred editor
  • Git: For cloning repositories and version control

Step 1: Core Development Tools

  • TypeScript/JavaScript Stack
  • Rust Stack
Node.js Installation (Choose One Method)
# Method 1: Node Version Manager (Recommended)
# Allows switching between Node.js versions
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Restart terminal or run: source ~/.bashrc
nvm install 18
nvm use 18
nvm alias default 18

# Method 2: Direct Installation
# Download from https://nodejs.org (18+ required)
# Follow installer instructions

# Method 3: Package Managers
# macOS with Homebrew
brew install node@18
# Ubuntu/Debian
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
Package Manager Setup
# Option 1: pnpm (Fastest, recommended)
npm install -g pnpm
# Verify: pnpm --version

# Option 2: Yarn (Alternative)
npm install -g yarn
# Verify: yarn --version

# Option 3: npm (Built-in, works everywhere)
# Already installed with Node.js
# Verify: npm --version
TypeScript Configuration (Recommended)
# Install TypeScript globally
npm install -g typescript

# Or install per project
npm install -D typescript @types/node

# Create basic tsconfig.json
npx tsc --init

Step 2: Solana Development Environment

Solana CLI Installation
# Install latest stable version
sh -c "$(curl -sSfL https://release.solana.com/v1.16.0/install)"

# Add to PATH (add this to ~/.bashrc, ~/.zshrc, or ~/.profile)
export PATH="/home/$USER/.local/share/solana/install/active_release/bin:$PATH"

# Reload shell or restart terminal
source ~/.bashrc  # or ~/.zshrc

# Verify installation
solana --version
solana-keygen --version
Network Configuration
# Set default to devnet (free testing)
solana config set --url https://api.devnet.solana.com

# Alternative RPC endpoints for better performance:
# solana config set --url https://solana-api.projectserum.com  # Serum
# solana config set --url https://rpc.ankr.com/solana_devnet   # Ankr

# For production (when ready):
# solana config set --url https://api.mainnet-beta.solana.com

# Verify configuration
solana config get
Wallet Setup
# Create development keypair
solana-keygen new --outfile ~/.config/solana/devnet-wallet.json

# Set as default
solana config set --keypair ~/.config/solana/devnet-wallet.json

# Get your wallet address
solana address

# Request devnet SOL (run multiple times for more)
solana airdrop 2
solana airdrop 2
solana airdrop 2

# Check balance
solana balance
Never use development wallets with real funds! These wallets are for testing only. For mainnet development, use a secure wallet like Phantom or Solflare.

Step 3: SDK-Specific Configuration

  • DLMM TypeScript SDK
  • DLMM Rust SDK
  • Main SDK
Project Setup
# Create new project
mkdir my-dlmm-app && cd my-dlmm-app
npm init -y

# Install core dependencies
npm install @saros-finance/dlmm-sdk
npm install @solana/web3.js @solana/wallet-adapter-base
npm install @solana/wallet-adapter-react @solana/wallet-adapter-react-ui

# For React applications
npm install react react-dom @types/react @types/react-dom

# Development dependencies
npm install -D typescript @types/node vite
Environment Configuration
# Create .env file
cat > .env << 'EOF'
# Solana Network Configuration
SOLANA_NETWORK=devnet
SOLANA_RPC_URL=https://api.devnet.solana.com

# DLMM Configuration: do NOT hardcode program IDs. Retrieve from SDK at runtime.
# Example (TypeScript): dlmmService.getDexProgramId()

# Your Development Wallet (never commit real private keys!)
WALLET_PRIVATE_KEY=[1,2,3,...]  # Your devnet wallet array

# Development Settings
DEFAULT_SLIPPAGE=0.5
DEFAULT_COMMITMENT=confirmed
EOF

# Add to .gitignore
echo ".env" >> .gitignore
TypeScript Configuration (tsconfig.json)
{
  "compilerOptions": {
    "target": "ES2020",
    "lib": ["ES2020", "DOM", "DOM.Iterable"],
    "module": "ESNext",
    "skipLibCheck": true,
    "moduleResolution": "bundler",
    "allowImportingTsExtensions": true,
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx",
    "strict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noFallthroughCasesInSwitch": true
  },
  "include": ["src"],
  "references": [{ "path": "./tsconfig.node.json" }]
}

Step 4: IDE and Development Tools

VS Code Configuration (Recommended)
# Install VS Code extensions
code --install-extension ms-vscode.vscode-typescript-next  # TypeScript
code --install-extension rust-lang.rust-analyzer           # Rust
code --install-extension bradlc.vscode-tailwindcss        # Tailwind CSS  
code --install-extension ms-vscode.vscode-json            # JSON support
code --install-extension ms-vsliveshare.vsliveshare       # Live Share
VS Code Settings (.vscode/settings.json)
{
  "typescript.suggest.autoImports": true,
  "rust-analyzer.cargo.features": "all",
  "rust-analyzer.checkOnSave.command": "clippy",
  "editor.formatOnSave": true,
  "editor.codeActionsOnSave": {
    "source.fixAll": true
  },
  "[typescript]": {
    "editor.defaultFormatter": "ms-vscode.vscode-typescript-next"
  },
  "[rust]": {
    "editor.defaultFormatter": "rust-lang.rust-analyzer"  
  }
}

Step 5: Testing & Verification

Verify TypeScript Setup
// test-setup.ts
import { Connection } from '@solana/web3.js';
import * as dlmm from '@saros-finance/dlmm-sdk'; // or '@saros-finance/sdk'

async function verifySetup() {
  try {
    // Test connection
    const connection = new Connection('https://api.devnet.solana.com');
    const version = await connection.getVersion();
    console.log('βœ… Solana connection:', version);

    // Test SDK import
    console.log('βœ… Saros SDK imported successfully');
    console.log('βœ… Setup verification complete!');
  } catch (error) {
    console.error('❌ Setup verification failed:', error);
  }
}

verifySetup();
Verify Rust Setup
// src/main.rs
use solana_client::rpc_client::RpcClient;
use solana_sdk::commitment_config::CommitmentConfig;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    env_logger::init();
    
    // Test connection
    let rpc_url = "https://api.devnet.solana.com";
    let client = RpcClient::new_with_commitment(rpc_url, CommitmentConfig::confirmed());
    
    match client.get_version() {
        Ok(version) => {
            println!("βœ… Solana connection successful: {:?}", version);
            println!("βœ… Saros Rust environment ready!");
        }
        Err(e) => {
            println!("❌ Connection failed: {}", e);
        }
    }

    Ok(())
}
Run Verification
# TypeScript
npx ts-node test-setup.ts

# Rust  
cargo run

# Expected output should show βœ… for all checks

🚨 Common Issues & Solutions

Node.js Issues

# Node version conflicts
nvm use 18  # Switch to Node 18
nvm alias default 18  # Set as default

# Permission errors on global installs
npm config set prefix ~/.npm-global
export PATH=~/.npm-global/bin:$PATH

# Clear npm cache if packages fail to install
npm cache clean --force

Solana CLI Issues

# Connection timeouts
solana config set --url https://api.devnet.solana.com
# Try alternative: https://rpc.ankr.com/solana_devnet

# Airdrop failures
solana airdrop 1  # Try smaller amounts
# Or use https://solfaucet.com/

# Permission issues
chmod 600 ~/.config/solana/id.json

Rust Compilation Issues

# SSL/TLS errors
# Ubuntu/Debian:
sudo apt install pkg-config libssl-dev
# macOS:
brew install openssl
export OPENSSL_DIR=/usr/local/opt/openssl

# Dependency conflicts
cargo clean
cargo update

🎯 Next Step: Build Your First App

Environment configured? Now it’s time to build your first application with your chosen SDK. Each tutorial is designed to work with your freshly configured environment.
Environment not working? Check our Troubleshooting Guide or join the Saros Dev Station for real-time help.

Need help? Join the Saros Dev Station for real-time developer support.