Self-Hosting the Stack

Run the same Firebase Functions and facilitator services we deploy in production if you need a dedicated environment or custom routing.

Components

  • functions/src/proxy.ts – HTTPS Function enforcing the x402 handshake.
  • facilitator/functions/src/index.ts – Express facilitator that calls Coinbase verify/settle.
  • security/firestore.rules – Firestore security model for routes, transactions, and developers.
  • example/src/server.ts – Reference API that sits behind the proxy.

Key Environment Variables

ComponentKeyPurpose
ProxyX402_FACILITATOR_URLWhere verification and settlement requests are sent.
ProxyX402_NETWORK, X402_ASSET_*, X402_PAY_TODefault network, asset metadata, and receiving wallet.
ProxyDEVELOPER_TIMEOUT_MSMaximum wait time for your upstream API.
FacilitatorEVM_PRIVATE_KEY (+ optional Solana keys)Signs settlements on Base (and Solana in the future).
AuthPRIVY_APP_ID, PRIVY_APP_SECRETIssues Firebase custom tokens for signed-in builders.

Deploy with the Firebase CLI or reuse the infrastructure-as-code templates in this repo.