Prerequisites
- Node.js installed
- Wrangler CLI installed
- Cloudflare account
- Pinata account with API key
- Stripe account with crypto payments enabled
Setup
1. Clone the Repository
2. Configure Environment Variables
Copy the example environment file and fill in your values:
Generate an MPP secret key:
3. Local Development
http://localhost:8787.
4. Deploy
.dev.vars for deployed environments):
Architecture
The MPP Server is built with:Request Flow
- CORS middleware handles cross-origin requests
- MPP middleware intercepts
/v1/pin/*routes, calculates pricing, and manages the 402 challenge-response flow - Route handlers create signed Pinata upload URLs or proxy file downloads
- Stripe generates unique deposit addresses for each payment
Pricing Logic
Upload pricing is calculated per request based on file size:src/index.ts.