Getting Started
This guide will help you get started with Shade402, whether you're building an API that requires payments or creating a client that consumes paid APIs.
Prerequisites
Before you begin, ensure you have:
Node.js 18.0.0 or higher
pnpm 8.0.0 or higher (or npm/yarn)
A Solana wallet (for testing, you can generate one)
Access to a Solana RPC endpoint (devnet for testing, mainnet for production)
Installation
Install Shade402 packages using your preferred package manager:
# For API providers (server-side)
pnpm add @shade402/express @shade402/core
# For API consumers (client-side)
pnpm add @shade402/client @shade402/core
# For AI agent integrations
pnpm add @shade402/langchain @shade402/langgraphQuick Start: API Provider
Create a simple Express.js server that requires payment for an endpoint.
Step 1: Install Dependencies
Step 2: Create Server
Create a file server.ts:
Step 3: Set Environment Variables
Create a .env file:
Step 4: Run the Server
Quick Start: API Consumer
Create a client that automatically pays for API access.
Step 1: Install Dependencies
Step 2: Create Client
Create a file client.ts:
Step 3: Set Environment Variables
Step 4: Run the Client
Testing with Devnet
For testing, use Solana devnet:
Get devnet SOL from the faucet: https://faucet.solana.com
Get devnet USDC tokens (if needed)
Use devnet RPC:
https://api.devnet.solana.com
Production Setup
For production:
Use mainnet RPC endpoint (consider using a provider like Helius, QuickNode, or Alchemy)
Use real USDC token mint:
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1vSet
network: 'solana-mainnet'Store wallet private keys securely (environment variables, key management service)
Enable auto-verification for payment security
Monitor payment transactions and set up alerts
Next Steps
Learn about Core Concepts
Explore Express Integration for servers
Check out Client Usage for clients
See Examples for more complex use cases
Last updated
