Expand description
§tempo-x402-gateway
API gateway that adds x402 payment rails to any HTTP endpoint.
Register upstream APIs with a price, and clients pay per-request through the
gateway at /g/{slug}/{path}. Payments are verified and settled on-chain before
the request is proxied.
§Features
- Endpoint registration with atomic slug reservation (
BEGIN IMMEDIATE) - Embedded facilitator — runs in-process when
FACILITATOR_PRIVATE_KEYis set - Proxy with SSRF protection — HTTPS-only targets, private IP blocking, DNS validation
- Per-endpoint analytics — request counts, payment counts, revenue tracking
- Prometheus metrics —
ENDPOINT_PAYMENTSandENDPOINT_REVENUEwith slug labels - Pre-flight reachability check before payment settlement (don’t charge for dead targets)
- Extensible database — downstream crates (x402-node) add tables via
execute_schema()
§Modules
config— Gateway configuration (config::GatewayConfig)db— SQLite database with extensible schemamiddleware— Payment processing, header encoding, 402 response constructionproxy— HTTP proxy with header stripping and SSRF protectionroutes— Endpoint registration, gateway proxy, analytics, healthstate— Shared application statevalidation— URL and SSRF validationmetrics— Prometheus metricsfacilitator— Embedded facilitator bootstrap
Part of the tempo-x402 workspace.
Re-exports§
pub use config::GatewayConfig;pub use db::Database;pub use error::GatewayError;pub use state::AppState;
Modules§
- config
- cors
- CORS configuration for the gateway and node binaries.
- db
- error
- facilitator
- Embedded facilitator: payment verification and on-chain settlement.
- metrics
- middleware
- proxy
- routes
- state
- validation