Deployment Guide
Deploy your x402-enabled service to production and list it on the Nova402 marketplace.
Production Checklist
- • Switch from testnet to mainnet
- • Configure environment variables
- • Set up monitoring and logging
- • Deploy to hosting provider
- • Register on Nova402 marketplace
Environment Configuration
Update your environment variables for production:
# Production Environment NODE_ENV=production # Wallet address to receive payments WALLET_ADDRESS=0xYourMainnetWalletAddress # Network (switch from testnet to mainnet) NETWORK=base # was base-sepolia # Facilitator FACILITATOR_URL=https://facilitator.payai.network # Required for Base mainnet CDP_API_KEY_ID=your_coinbase_developer_platform_key CDP_API_KEY_SECRET=your_coinbase_developer_platform_secret # Optional: Custom RPC for better performance BASE_RPC_URL=https://mainnet.base.org # or use a paid RPC like Alchemy/Infura # BASE_RPC_URL=https://base-mainnet.g.alchemy.com/v2/YOUR_KEY
Hosting Options
Vercel
Best for Next.js and serverless APIs
vercel deploy --prodRailway
Simple deployment for any stack
railway upFly.io
Global edge deployment
fly deployAWS / GCP
Full control with cloud providers
Use ECS, Lambda, Cloud Run, etc.
Docker Deployment
Containerize your service for consistent deployments:
Dockerfile
FROM node:18-alpine WORKDIR /app COPY package*.json ./ RUN npm ci --production COPY . . EXPOSE 3000 CMD ["node", "dist/index.js"]
Build & Run
# Build image docker build -t my-x402-service . # Run container docker run -d \ -p 3000:3000 \ -e WALLET_ADDRESS=0x... \ -e NETWORK=base \ -e CDP_API_KEY_ID=... \ -e CDP_API_KEY_SECRET=... \ my-x402-service
Performance Optimization
Use Paid RPC
Free public RPCs have rate limits. Use Alchemy, Infura, or QuickNode for production.
Cache Payment Verifications
Cache verified transactions to avoid redundant blockchain queries.
Enable Compression
Use gzip/brotli compression to reduce response sizes and improve speed.
Set Timeouts
Configure appropriate timeouts for facilitator calls to prevent hanging requests.
Monitoring & Logging
// Add logging to track payments
app.use(
paymentMiddleware(
walletAddress,
routes,
{
url: facilitatorUrl,
onPaymentReceived: (txHash, amount, network) => {
console.log(`Payment received: ${amount} on ${network}`);
console.log(`Transaction: ${txHash}`);
// Send to analytics
analytics.track('payment_received', {
txHash,
amount,
network,
timestamp: Date.now()
});
},
onPaymentFailed: (error, txHash) => {
console.error(`Payment failed: ${error}`);
// Alert on failures
errorTracking.captureException(error);
}
}
)
);Register on Nova402
Once your service is deployed, register it on the marketplace:
Visit Marketplace
Go to Nova Hub and click "Register Service"
Fill Service Details
- • Service name and description
- • API endpoint URL
- • Pricing information
- • Category and tags
Test & Publish
Verify your service works correctly, then publish to the marketplace
Security Best Practices
Environment Variables
Never commit secrets to git. Use environment variables or secret managers.
Rate Limiting
Implement rate limiting to prevent abuse even after payment verification.
HTTPS Only
Always use HTTPS in production to protect payment headers and data.
Input Validation
Validate and sanitize all inputs even for paid endpoints.
Ready to Launch?
Deploy your service and start earning from x402 payments.