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:
| Package | Description | Use Case |
|---|---|---|
@vanta/sdk | Core types and utilities | Always required |
@vanta/middleware | Server-side middleware | API servers |
@vanta/client | Client-side SDK | Browser/Node clients |
Server Installation
For API servers that need to accept payments:
npm install @vanta/sdk @vanta/middlewareClient Installation
For applications that need to make requests to payment-protected APIs:
npm install @vanta/sdk @vanta/clientFull Installation
For projects that need both server and client functionality:
npm install @vanta/sdk @vanta/middleware @vanta/clientPeer 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 ethersFramework 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-honoTypeScript Setup
Vanta SDK is written in TypeScript and includes type definitions. For the best experience, ensure your tsconfig.json has:
{
"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:
# 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:6379Security Note
.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:
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.tsNext Steps
Now that you have Vanta SDK installed, continue to the Quick Start guide to build your first payment-protected API endpoint.