/** * Bun example — stripe-mpp-proxy * * Demonstrates the full-stack config: Stripe (card) + Tempo (crypto) + Base (USDC) * with two independently-proxied services. * * Run: * cp ../../.env.example .env # fill in your keys * bun run index.ts * * Requests are routed by service prefix: * /inference/v1/infer → INFERENCE_ORIGIN_URL * /data/v1/records/* → DATA_ORIGIN_URL */ import { createProxy } from '../../src/index.js' const proxy = createProxy({ stripe: { secretKey: process.env.STRIPE_SECRET_KEY!, networkId: process.env.STRIPE_NETWORK_ID ?? 'internal', }, tempo: { recipient: process.env.TEMPO_RECIPIENT as `0x${string}`, testnet: true, }, base: { payTo: process.env.BASE_PAY_TO as `0x${string}`, network: 'base-sepolia', }, services: { inference: { origin: process.env.INFERENCE_ORIGIN_URL!, routes: [ { method: 'POST', path: '/v1/infer', description: 'Single inference request', pricing: { stripe: { amount: '0.05', currency: 'usd' }, tempo: { amount: '0.04' }, base: { amount: '0.05' }, }, }, ], }, data: { origin: process.env.DATA_ORIGIN_URL!, routes: [ { method: 'GET', path: '/v1/records/*', pricing: { stripe: { amount: '0.01', currency: 'usd' }, tempo: { amount: '0.008' }, base: { amount: '0.01' }, }, }, ], }, }, }) const port = Number(process.env.PORT ?? 3000) Bun.serve({ port, fetch: proxy.fetch }) console.log(`[bun] stripe-mpp-proxy listening on http://localhost:${port}`)