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
| Component | Key | Purpose |
|---|---|---|
| Proxy | X402_FACILITATOR_URL | Where verification and settlement requests are sent. |
| Proxy | X402_NETWORK, X402_ASSET_*, X402_PAY_TO | Default network, asset metadata, and receiving wallet. |
| Proxy | DEVELOPER_TIMEOUT_MS | Maximum wait time for your upstream API. |
| Facilitator | EVM_PRIVATE_KEY (+ optional Solana keys) | Signs settlements on Base (and Solana in the future). |
| Auth | PRIVY_APP_ID, PRIVY_APP_SECRET | Issues Firebase custom tokens for signed-in builders. |
Deploy with the Firebase CLI or reuse the infrastructure-as-code templates in this repo.