1. Prerequisites
- Node.js 22+
- npm 10+
- Base Sepolia RPC endpoint
- Funded deployer wallet private key
- MoonPay CLI configured for execution mode
Backend Guide
Complete setup for API, server-mech, and production telemetry. This guide is backend-first and aligned with live execution paths.
Use these values exactly. Keep endpoint URLs without trailing slash.
# apps/web/.env.local NEXT_PUBLIC_API_BASE_URL=https://policypayapi-production.up.railway.app NEXT_PUBLIC_SERVER_MECH_BASE=https://policypayserver-mech-production.up.railway.app # backend env (.env) BASE_SEPOLIA_RPC_URL=https://sepolia.base.org DEPLOYER_PRIVATE_KEY=0x... POLICY_PAY_CORE_ADDRESS=0x051cAD2fcf7D1ff415c35a8090f0507D454bd608 POLICYPAY_API_BASE=http://localhost:4000 POLICYPAY_POLICY_ID=policy/base-sepolia/default MOONPAY_ENABLE_EXECUTION=true MOONPAY_BIN=/app/node_modules/.bin/mp MOONPAY_TIMEOUT_MS=120000 MOONPAY_WALLET_NAME=main
npm install # terminal 1: backend api npm run -w @policypay/api dev # terminal 2: server mech npm run -w @policypay/server-mech dev # terminal 3: web ui npm run -w @policypay/web dev
# trigger one backend serve
curl -X POST http://localhost:4100/mech/serve -H "content-type: application/json" -d '{
"requester":"olas-client-agent",
"task":"policy-pay-demo",
"amountEth":"0.0001",
"moonpay": {
"enabled": true,
"simulation": false,
"tool": "token balance list",
"options": {"wallet":"main","chain":"base"}
}
}'
# check runtime stats
curl http://localhost:4100/stats