Installation

Install and configure Vanta SDK packages for your project.

Requirements

  • Node.js 18.0 or later
  • TypeScript 5.0 or later (recommended)
  • A package manager: npm, yarn, or pnpm

Package Overview

Vanta SDK is modular—install only the packages you need:

PackageDescriptionUse Case
@vanta/sdkCore types and utilitiesAlways required
@vanta/middlewareServer-side middlewareAPI servers
@vanta/clientClient-side SDKBrowser/Node clients

Server Installation

For API servers that need to accept payments:

npm install @vanta/sdk @vanta/middleware

Client Installation

For applications that need to make requests to payment-protected APIs:

npm install @vanta/sdk @vanta/client

Full Installation

For projects that need both server and client functionality:

npm install @vanta/sdk @vanta/middleware @vanta/client

Peer Dependencies

Depending on your setup, you may need additional packages:

Ethereum Provider (Client)

The client SDK needs an Ethereum provider for signing transactions. You can use ethers.js, viem, or any EIP-1193 compatible provider:

npm install ethers

Framework Adapters

For specific frameworks, install the corresponding adapter:

# Next.js
npm install @vanta/adapter-nextjs

# Fastify
npm install @vanta/adapter-fastify

# Hono
npm install @vanta/adapter-hono

TypeScript Setup

Vanta SDK is written in TypeScript and includes type definitions. For the best experience, ensure your tsconfig.json has:

tsconfig.json
{
  "compilerOptions": {
    "moduleResolution": "bundler",
    "target": "ES2020",
    "lib": ["ES2020", "DOM"],
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "types": ["node"]
  }
}

Environment Variables

Create a .env file with your configuration:

.env
# Required: Your wallet address for receiving payments
VANTA_RECIPIENT_ADDRESS=0x742d35Cc6634C0532925a3b844Bc4e7595f0aB42

# Required: Secret for signing access tokens
VANTA_TOKEN_SECRET=your-secure-random-secret-at-least-32-characters

# Optional: Default network (base, ethereum, optimism, arbitrum)
VANTA_NETWORK=base

# Optional: RPC URLs for blockchain verification
VANTA_RPC_BASE=https://mainnet.base.org
VANTA_RPC_ETHEREUM=https://eth.llamarpc.com

# Optional: Redis URL for quota storage
REDIS_URL=redis://localhost:6379

Security Note

Never commit your .env file to version control. Add it to your .gitignore. Use a secrets manager in production.

Verifying Installation

Create a simple test file to verify the installation:

test-vanta.ts
import { VantaMiddleware } from '@vanta/middleware'
import { VantaClient } from '@vanta/client'
import { parseChallenge } from '@vanta/sdk'

console.log('VantaMiddleware:', typeof VantaMiddleware)
console.log('VantaClient:', typeof VantaClient)
console.log('parseChallenge:', typeof parseChallenge)
console.log('✓ Vanta SDK installed successfully!')
npx tsx test-vanta.ts

Next Steps

Now that you have Vanta SDK installed, continue to the Quick Start guide to build your first payment-protected API endpoint.