Deployment
A production deployment of FlowPayra Lite is the single binary flowpayra-lite plus PostgreSQL 15 or later. The checkout and console front ends, the contract code and the database migrations are compiled into the binary, so building the image needs neither Node nor Foundry.
Checklist
Section titled “Checklist”- Build the image; generate the master key and the quote signer key.
- Fill in
deploy/.envand the configuration file, and start the services. - Put an HTTPS reverse proxy in front and set
public_url. - Create the first admin and sign in to the console.
- Per chain, deploy the merchant contracts and list tokens; configure the hot wallet if needed.
- Set up backups, health checks and monitoring.
Docker image
Section titled “Docker image”docker build -t flowpayra-lite . # multi-stage build; the runtime image is based on debian:bookworm-slimdocker run --rm flowpayra-lite keygen # generate the master key (32 bytes, hex)- The container runs as the non-root user
flowpay(uid 10001) and listens on0.0.0.0:8080; itsHEALTHCHECKprobes/healthz. - The configuration file is
/etc/flowpay/config.toml(named by theFLOWPAY_CONFIGenvironment variable; the file may be absent). - Any setting can be overridden by a
FLOWPAY_*environment variable, nested keys joined with__, for exampleFLOWPAY_DATABASE__URL. - Keystore files are mounted read-only at
/etc/flowpay/keys; their passwords are read from environment variables. - The default command is
serve, which runs every role.
docker compose
Section titled “docker compose”The repository’s docker-compose.yml contains the app and postgres:16: the database uses the pgdata volume, is reachable only on the compose network, and must be healthy before the app starts. deploy/config.docker.toml is mounted as /etc/flowpay/config.toml; deploy/.env and the files in deploy/keys/ stay out of version control.
cp deploy/.env.example deploy/.env # fill in the variables belowcast wallet new deploy/keys quote-signer.json # new quote signer keystore (or: cast wallet import … -k deploy/keys -i for an existing key)docker compose --env-file deploy/.env up -d --buildVariables in deploy/.env:
| Variable | Description |
|---|---|
FLOWPAY_SECRETS__MASTER_KEY |
The master key; required |
FLOWPAY_SIGNER_PASSWORD |
Password of deploy/keys/quote-signer.json |
FLOWPAY_RELAYER_PASSWORD |
Password of deploy/keys/hot-wallet.json, when the hot wallet is enabled |
FLOWPAY_PUBLIC_URL |
The HTTPS address payers and admins reach |
FLOWPAY_HTTP_PORT |
Host port the app is published on; default 8080 |
FLOWPAY_KEYS_DIR |
Directory holding the keystores; default ./deploy/keys |
POSTGRES_PASSWORD |
Password of the bundled database |
FLOWPAY_IMAGE |
Set it to use a registry image, and start with --no-build |
Configuration essentials
Section titled “Configuration essentials”Every option is listed in config.example.toml in the repository. The following matter in production.
Addresses
Section titled “Addresses”listen = "0.0.0.0:8080"public_url = "https://pay.example.com"# trusted_proxies = ["127.0.0.1"]public_urlis the address payers reach this deployment at. Checkout links are built from it, and it is the console’s passkey (WebAuthn) site. Production needs an HTTPS domain.trusted_proxieslists the reverse proxies in front of the server, as exact IP addresses. TheirX-Forwarded-Forgives the client IP used for the help form’s rate limits and the audit log; leave it empty when clients connect directly.
A separate listener for the console
Section titled “A separate listener for the console”[admin]# listen = "10.0.0.5:8081"# public_url = "https://admin.example.internal"- By default the console shares the public listener. With
listenset, the console (/adminand/admin/api) is served only on that address, for example an internal interface or a separate port; the public listener answers 404 for/admin. The console listener serves only the console and/healthz. - Set
admin.public_urlwhen admins open the console at an address other thanpublic_url. It is the console’s passkey site and the link in admin notification emails.
Database
Section titled “Database”[database]max_connections = 10migrate_on_start = truemax_connections is the pool shared by API requests and background queries. Background roles elect a leader with PostgreSQL advisory locks, and each lock sits on a dedicated connection outside the pool: up to 7 per instance, plus 1 per indexed chain. Size PostgreSQL’s own max_connections for at least instances × (pool size + 7 + chains), with headroom. For example, 2 instances and 3 chains: 2 × (10 + 7 + 3) = 40.
Master key
Section titled “Master key”[secrets]# master_key = ""# previous_master_keys = []- The master key is a 32-byte hex key that encrypts every sensitive value in the database: RPC URLs, webhook secrets, email addresses, the stored quote signer keys and credentials. Generate it with
flowpayra-lite secrets keygen(orflowpayra-lite keygen, which prints the key only). - It stays in the configuration or the environment, never in the database. Prefer the environment variable
FLOWPAY_SECRETS__MASTER_KEY. - Without the master key that data cannot be decrypted. Keep it separately from database backups: pipe it from the configuration straight into a password manager or an encrypted file, never showing it in a terminal, then check the copy with
flowpayra-lite secrets check-backup(reads the copy from standard input, never prints the key), which opens the encrypted data in the database with it. previous_master_keysis used only while rotating the master key, for decryption. Rotation is done from the console’s Master key page.

Quote signer key
Section titled “Quote signer key”[quote_signer]keystore = "/etc/flowpay/keys/quote-signer.json"password_env = "FLOWPAY_SIGNER_PASSWORD"- Production uses an Ethereum JSON keystore, with its password in the named environment variable.
- The configured key joins the keyring on the first start (stored in the database, encrypted under the master key) as the active key. Afterwards, take an offline backup with
flowpayra-lite signer exportand keep the backup file and its password apart. - The quote signer key’s address is embedded in the merchant contracts. Replacing the key means deploying new merchant contracts for the new key, from the console’s Quote signer keys page or with
flowpayra-lite signer …. - Solana chains use a separate ed25519 quote signer key, generated on the Quote signer keys page or with
flowpayra-lite signer generate --scheme ed25519.
KMS (optional)
Section titled “KMS (optional)”The quote signer key can also live in AWS KMS or Google Cloud KMS; this is off by default. Enable it and add a connection in the signing backends / KMS section of the console’s Quote signer keys page, or with the flowpayra-lite kms … commands.
- AWS KMS: key spec
ECC_SECG_P256K1; credentials are an access key or the server environment (environment variables, an ECS / EKS task role, an EC2 instance role). - Google Cloud KMS: algorithm
EC_SIGN_SECP256K1_SHA256; credentials are a service account key file or the metadata server. - Keys in a KMS cannot be exported; their backup is the cloud provider’s responsibility. KMS supports secp256k1 keys only (EVM and TRON chains); the hot wallet remains a local key.
Hot wallet (optional)
Section titled “Hot wallet (optional)”[relayer]# keystore = "/etc/flowpay/keys/hot-wallet.json"# password_env = "FLOWPAY_RELAYER_PASSWORD"replace_after_secs = 90min_balance_wei = "0"The hot wallet sponsors gas and sends subscription charges: configure it, and fund it with a small amount of native coin, when using gas sponsorship or subscriptions. It must differ from the quote signer key and should hold only a small balance. Solana chains have a separate solana_keystore option. See Gas and hot wallets.
Other settings
Section titled “Other settings”| Setting | Description |
|---|---|
[orders] default_ttl_secs |
Default order lifetime; 1800 seconds |
[orders] quote_ttl_secs |
Quote validity; 600 seconds |
[metrics] token |
Enables /metrics when set (see below) |
[mail] dns_server |
DNS server for the console’s sender-domain checks (SPF, DKIM, DMARC) |
[log] json |
true writes one JSON object per line, for log collectors |
[diag] enabled |
The wallet diagnostic page /diag/; keep false in production |
The WalletConnect projectId is not in the configuration file; it is entered in the console, see Wallet support.
Reverse proxy and HTTPS
Section titled “Reverse proxy and HTTPS”The server speaks plain HTTP. Put a reverse proxy (Caddy, nginx or similar) in front to terminate TLS and forward requests to it.
What the server needs
Section titled “What the server needs”| Item | Requirement |
|---|---|
public_url |
The HTTPS address of the checkout and the API (FLOWPAY_PUBLIC_URL with docker compose). The server builds links from it; it does not read the Host or X-Forwarded-Proto headers |
trusted_proxies |
The proxy’s IP address as the server sees it. Entries are exact IP addresses, not ranges. Only connections from these addresses have their X-Forwarded-For header read, so the proxy must set that header |
| Request size | Most requests are limited to 64 KB by the server. The payment help form accepts up to about 16 MB (three screenshots of 5 MB each), and a risk list import in the console up to 24 MB. Caddy sets no limit of its own; with nginx, raise client_max_body_size (1 MB by default) accordingly |
| Protocol | Ordinary HTTP requests and responses only; the server has no WebSocket endpoints. A request that takes longer than 30 seconds is ended by the server with 408 |
| Page rewriting | The content security policy of the HTML pages (checkout, console, payment help and so on) allows scripts from the site itself only (the payment help page also allows the human verification service that is turned on), and the pages are sent with Cache-Control: no-transform. Proxies and CDNs that honour the header, such as Cloudflare, therefore leave the pages unchanged (no injected analytics beacon, Rocket Loader or email obfuscation). The proxy should not remove the header or inject scripts into the pages; the browser would block such scripts |
With docker compose the proxy on the host reaches the container through the Docker network, so the address the server sees is that network’s gateway, not 127.0.0.1 (the commented example in deploy/config.docker.toml is 172.18.0.1; docker network inspect shows the actual gateway). Set FLOWPAY_HTTP_PORT to change the host port the public listener is published on.
One hostname
Section titled “One hostname”By default the console shares the public listener (port 8080): one hostname serves the checkout, the API and the console, which is at https://pay.example.com/admin/.
pay.example.com { reverse_proxy 127.0.0.1:8080}Two hostnames
Section titled “Two hostnames”To serve the checkout and API at pay.example.com and the console at admin.example.com, give the console its own listener. There is no default console port; 8081 is used here.
listen = "0.0.0.0:8080"public_url = "https://pay.example.com"trusted_proxies = ["127.0.0.1"] # with docker compose: the Docker network's gateway
[admin]listen = "0.0.0.0:8081"public_url = "https://admin.example.com"With docker compose, make these changes in deploy/config.docker.toml (public_url comes from FLOWPAY_PUBLIC_URL), and publish the console port by adding it to the ports of the app service in docker-compose.yml:
ports: - "${FLOWPAY_HTTP_PORT:-8080}:8080" - "127.0.0.1:8081:8081"The Caddy configuration then has one site per listener:
pay.example.com { reverse_proxy 127.0.0.1:8080}
admin.example.com { reverse_proxy 127.0.0.1:8081}- Caddy obtains the certificates and sets
X-Forwarded-Foritself. With nginx, addproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;to eachlocation. - The console is at
https://admin.example.com/admin/. The console listener serves only/admin,/admin/apiand/healthz; the public listener answers 404 for/admin. /readyzand/metricsare on the public listener.- The console listener can instead be bound to an internal address (for example
listen = "10.0.0.5:8081") and reached without a public hostname;admin.public_urlis then the internal address admins open.
The first admin
Section titled “The first admin”docker compose --env-file deploy/.env exec -e FLOWPAY_ADMIN_PASSWORD='…' app flowpayra-lite admin create --username aliceThe password needs at least 12 characters. On the first sign-in the admin sets up a second factor (a passkey, a security key or Google Authenticator), and the system generates 10 single-use recovery codes. Further members are added on the console’s Team page.
An admin who has lost every factor can be reset on the server:
flowpayra-lite admin reset --username alice --new-passwordThe command clears all of the account’s factors; with --new-password it resets the password too. See Admins and passkeys.
After the first start
Section titled “After the first start”- Each chain: add the chain in the console’s Chains & tokens page, deploy and verify the merchant contracts through the Contracts checklist, then enable the chain. The command-line equivalent takes two steps:
flowpayra-lite deploy all --rpc <RPC> --signer <quote signer address>(the paying key comes from the environment variableFLOWPAY_DEPLOYER_KEY) deploys the contracts, sending transactions only and writing nothing to the database; thenflowpayra-lite signer verify --address <quote signer address> --chain <chain id>verifies and records them. Give--chainfor a chain that is not enabled yet: without it,signer verifycovers only enabled chains. - Tokens: list tokens on each chain; their capabilities are probed on listing.
- RPC endpoints: at least 2 endpoints per chain are recommended, one of them
wss, for lower booking latency. - Hot wallet: configure and fund it for gas sponsorship or subscriptions.
These steps are covered in Chains and contracts.
serve runs every role by default. Multi-instance deployments can split them with --role, for example serve --role api and serve --role indexer,notifier,expirer,relayer.
| Role | Responsibility |
|---|---|
api |
The business API, the checkout and the console. Stateless; scales horizontally |
indexer |
One per chain: reads the merchant contracts’ events, books payments once confirmed, handles reorganisations |
notifier |
Delivers webhooks, emails and alerts |
expirer |
Scheduled work such as order expiry, refund re-checks and list imports |
relayer |
Sends sponsored transactions from the hot wallet; the keeper (subscription charges and on-chain cancellations) runs with this role |
Background roles elect a leader through PostgreSQL advisory locks, so only one instance does the work at a time; when the leader is lost, another instance takes over within about 10 seconds.
Health checks and metrics
Section titled “Health checks and metrics”| Endpoint | Purpose |
|---|---|
/healthz |
Process liveness only; use it for container liveness probes |
/readyz |
Checks the database and returns 503 when it is unavailable; also reports the RPC status of each enabled chain, WalletConnect and the quote signer key. A problem in those reports as degraded without a 503, which suits load balancers |
/metrics |
Prometheus metrics: order states, webhook and email queues, chain heights and indexing lag, RPC endpoint health and latency, open alerts, WalletConnect |
/metrics is off by default. Set [metrics] token (16 characters or more, or the environment variable FLOWPAY_METRICS__TOKEN) to enable it; scrapers must send Authorization: Bearer <token>.
curl -fsS localhost:8080/healthzcurl -fsS localhost:8080/readyzRead logs with docker compose logs app; the example configuration writes JSON lines.
Backups
Section titled “Backups”docker compose --env-file deploy/.env exec -T postgres pg_dump -U flowpay flowpay > flowpay.sql- In production, enable PostgreSQL WAL archiving for point-in-time recovery.
- On-chain data can be restored by the indexer rescanning from the block the contracts were deployed at.
- Keep these apart from each other: database backups, the master key, and the offline backups of the quote signer keys (JSON keystores: the secp256k1 key for EVM and TRON, the ed25519 key for Solana) and their passwords.
- After a master key rotation, keep the old master key until the oldest database backup that may still be restored has expired; those backups are encrypted under it.
Upgrades
Section titled “Upgrades”-
Back up the database.
-
Update the code, rebuild the image and restart:
Terminal window git pull && docker compose --env-file deploy/.env up -d --buildWith a registry image, set
FLOWPAY_IMAGEand add--no-build. -
Database migrations run automatically at startup (
migrate_on_start = true).
Related pages
Section titled “Related pages”- Security model: the boundaries of each key.
- Chains and contracts: adding chains and deploying the merchant contracts.
- Admins and passkeys: admins, roles and second factors.