Skip to main content
The MPP Server is open source and designed to run on Cloudflare Workers. Deploy your own instance to customize pricing, integrate with your own Pinata account, and control the payment flow.

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

The server starts at http://localhost:8787.

4. Deploy

Set your secrets in Cloudflare (alternative to .dev.vars for deployed environments):

Architecture

The MPP Server is built with:

Request Flow

  1. CORS middleware handles cross-origin requests
  2. MPP middleware intercepts /v1/pin/* routes, calculates pricing, and manages the 402 challenge-response flow
  3. Route handlers create signed Pinata upload URLs or proxy file downloads
  4. Stripe generates unique deposit addresses for each payment

Pricing Logic

Upload pricing is calculated per request based on file size:
Download pricing is a flat rate:
You can customize these values in src/index.ts.

Project Structure

Resources