Skip to content

Architecture ​

GMPay Edge runs as one Worker or one Bun/Nitro container. Both runtimes own the same product surfaces and shared order/payment core; only the infrastructure adapters differ.

Product surfaces ​

  • Merchant clients call the GMPay or EPay-compatible boundaries.
  • Payers use the hosted checkout.
  • Operators use /admin.
  • Telegram users interact through the configured bot.

Runtime services ​

CapabilityCloudflare WorkersBun/Nitro Docker
DatabaseD1SQLite in GMPAY_DATA_DIR
CacheKVLocal runtime cache
Private objectsR2Persistent local object storage
Background workCloudflare QueuesDurable local queues
SchedulingCron TriggersBun scheduler

The Bun data directory also contains uploaded files and durable queue state. It must be mounted to a persistent volume and included in backups.

Cloudflare bindings ​

BindingCloudflare productPurpose
DBD1Authoritative application, payment, authorization, and delivery data
CACHEKVShort-lived validated caches and ancillary telemetry
FILESR2Private payment-review evidence and generated exports
PAYMENT_QUEUEQueuesAsynchronous payment scanning
WEBHOOK_QUEUEQueuesAsynchronous merchant Webhook delivery

Background work ​

Runtime-specific durable queues and schedulers move payment scans and Webhook retries outside synchronous requests. They also handle payment expiry, cleanup, connection health checks, and rate sync.

Webhook delivery uses a durable outbox with retry history, manual retry, and audit records on either runtime.

Data and security model ​

  • D1 or SQLite is authoritative for the selected runtime.
  • Cache and private-object storage use the selected runtime's adapters.
  • Payment adapters are read-only.
  • Administration uses Better Auth, TOTP, and dynamic multi-role RBAC.

Protocol boundaries ​

GMPay uses HMAC-SHA256 signatures. EPay compatibility remains a legacy MD5 boundary. Outbound callbacks retain the originating protocol's signature format.

最近更新