Prerequisites
Before you begin, ensure you have:
- Node.js 20.9.0 or higher
- npm 10.0.0 or higher
- A Base network wallet (MetaMask recommended)
- USDC on Base mainnet for testing
- A Coinbase Developer Platform account (for PayAI facilitator)
Set up your r1x development environment and start building on the machine economy.
Before you begin, ensure you have:
Create a .env.local file in your project root with the following variables:
DATABASE_URL="postgresql://..."
MERCHANT_ADDRESS="0x..."
FEE_RECIPIENT_ADDRESS="0x..."
PLATFORM_FEE_PERCENTAGE=5
NETWORK=base
ANTHROPIC_API_KEY="sk-ant-..."
CDP_API_KEY_ID="your-cdp-api-key-id"
CDP_API_KEY_SECRET="your-cdp-api-key-secret"
NEXT_PUBLIC_BASE_URL="http://localhost:3000"
FACILITATOR_URL="https://facilitator.payai.network"r1x uses Prisma with PostgreSQL. Set up your database:
# Generate Prisma client
npx prisma generate
# Run migrations (development)
npx prisma migrate dev
# Run migrations (production)
npx prisma migrate deploy
# Open Prisma Studio (optional)
npx prisma studioInstall dependencies and start the development server:
# Install dependencies
npm install
# Start development server
npm run dev
# Start x402 Express server (separate terminal)
npm run dev:x402
# Start both servers concurrently
npm run dev:allAfter deployment, sync services from PayAI facilitator:
# Trigger PayAI service sync
curl -X POST https://your-domain.vercel.app/api/sync/payai
# Or with authentication (if SYNC_SECRET is set)
curl -X POST https://your-domain.vercel.app/api/sync/payai \
-H "Authorization: Bearer YOUR_SYNC_SECRET"