Quickstart

This guide will get you all set up and ready to use the Cart.fun Protocol. We'll cover how to set up your development environment, install the necessary tools, and make your first integration with our decentralized commerce infrastructure.

Prerequisites

Before you begin, ensure your system meets these requirements:

  • Operating System: macOS, Linux, or Windows (with WSL recommended for Windows)
  • RAM: 8GB minimum, 16GB+ recommended
  • Storage: 20GB+ free space (for Solana, Rust, and Node.js toolchains)
  • CPU: Modern multi-core processor

Install Required Tools

To work with the Cart.fun protocol, you'll need to install several tools:

# Install Rust and Cargo (for Solana program development)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Set up required Rust version and components
rustup default stable
rustup component add rustfmt clippy

Install the Cart.fun SDK

After setting up the required tools, install the Cart.fun TypeScript SDK:

npm install @cartdotfun/sdk @solana/web3.js @project-serum/anchor

Make Your First Integration

Let's create a simple script that connects to the Cart.fun protocol and retrieves some basic information:

import { Connection, PublicKey } from '@solana/web3.js'
import { CartProtocol, NetworkType } from '@cartdotfun/sdk'

async function main() {
  // Connect to Solana devnet
  const connection = new Connection(
    'https://api.devnet.solana.com',
    'confirmed',
  )

  // Initialize the Cart.fun SDK
  const cartProtocol = new CartProtocol({
    connection,
    network: NetworkType.Devnet,
  })

  // Get all available marketplaces
  const marketplaces = await cartProtocol.marketplace.getAllMarketplaces()
  console.log('Available marketplaces:', marketplaces)

  // Get all products from a specific marketplace
  if (marketplaces.length > 0) {
    const products = await cartProtocol.product.getProductsByMarketplace(
      marketplaces[0].publicKey,
    )
    console.log('Products in first marketplace:', products)
  }
}

main()

What's next?

Now that you're set up with the basic tools and have made your first integration, here are some resources to explore:

Was this page helpful?