Architecture
ETHPayServer is two binaries that communicate over Redis, plus a Postgres database.
┌─────────────────────────────────────────────────────────────┐
│ API server (ethpayserver binary) │
│ ├── /health, /stores, /invoices, /auth, /evm │
│ ├── Background services (expiration, cleanup, webhooks) │
│ └── PgDataService — repository implementations │
└─────────────────────────────────────────────────────────────┘
│ Redis pub/sub
▼
┌─────────────────────────────────────────────────────────────┐
│ evmmonitor (separate binary, one or many instances) │
│ ├── Block subscriptions (WebSocket, HTTP polling fallback) │
│ ├── Native + ERC20 transfer detection │
│ ├── Confirmation tracking │
│ └── Reorg detection │
└─────────────────────────────────────────────────────────────┘
│ RPC (HTTP + WebSocket)
▼
one or more EVM chains
Why two binaries
The API server handles HTTP requests, auth, and invoice state. The monitor watches chains for payments and reports what it finds back over Redis. Splitting them means:
- The monitor can run as several instances (one per chain, or sharded), independent of how many API server replicas are running.
- A slow or stalled chain doesn’t block invoice creation, login, or anything else HTTP-facing.
- Either side can restart without losing state — watched addresses and pending confirmations are restored from Postgres.
The non-custodial guarantee
The monitor only ever watches addresses — it’s handed a derived public address to watch for incoming transfers, never a private key. See Non-Custodial Design for how that’s actually enforced, not just a description of intent.
RPC provider resilience
Each chain’s HTTP calls go through an ordered pool of providers: a primary, plus any configured
fallbacks, tried in order on a rate limit, timeout, or 5xx. The pool is sticky — it keeps using
whichever provider last worked rather than round-robining every call — and a provider that just
failed sits out a short cooldown before being retried. See the EVMMONITOR_CHAIN_<id>_RPC_HTTP_FALLBACKS
example in Quickstart.
The real-time WebSocket block subscription does not yet have the same multi-provider failover — only the HTTP request/response path does today.
The repository split
The web frontend (payserver-client) is a
separate repository on purpose: it’s built to talk to any payserver over the same API shape, not
only this one. It has no dependency on this repo, and this repo has no dependency on it — they
communicate purely over HTTP, at whatever URL the client is configured to point at.
Shared types, auth, and crypto primitives used by more than one of these repos live in
payserver-commons, pinned here by git
revision rather than a published version — a change there doesn’t reach this repo until that
pin is deliberately bumped.