How abdalrhman-mostafa/payops-ecommerce works
PayOps Ecommerce is a learning commerce system: customers browse and purchase through a Next.js storefront, while staff use its console; a same-origin BFF routes requests to independently deployed services. Commerce owns the transactional order, stock, payment, refund, ledger, and webhook domain; Identity separately manages customer accounts and carts. The gateway authorizes payment API requests, processes simulated connector payments, and dispatches signed webhooks. The README documents these service boundaries and the worker’s maintenance call. Several internal service connections are documented rather than shown in sampled call sites, so those edges cite the README; internal gateway calls cite sampled source.
Main entry points: server.js Gateway API · api Commerce API · payments.js Payment processing · route.ts Web API and BFF
Components 21
Storefront and BFF
- Storefront
services/web/src/app - Staff console
services/web/src/app/admin - Web API and BFF
services/web/src/app/api/[...path]/route.ts - Customer API
services/web/src/app/api/customer - Invoice proxy
services/web/src/app/api/invoice/route.ts
Commerce domain
- Commerce API
services/commerce/src/app/api - Orders and finance
services/commerce/src/lib - Commerce database
services/commerce/src/lib/db.ts - Webhook inbox
services/commerce/src/lib/webhooks.ts
Customer identity
- Identity service
services/identity/server.mjs - Identity database
services/identity/server.mjs
Payment gateway
- Gateway API
services/gateway/src/server.js - API key auth
services/gateway/src/auth.js - Payment processing
services/gateway/src/payments.js - Simulated connectors
services/gateway/src/connectors.js - Hosted checkout
services/gateway/src/pay-page.js - Webhook delivery
services/gateway/src/webhooks.js - Gateway database
services/gateway/src/db.js
Maintenance
- Maintenance worker
Other components
- Shopper
- External PayOps
Connections 22
- Shopper → Storefront: browses
README.md - Staff console → Web API and BFF: manages
README.md - Shopper → Web API and BFF: submits requests
README.md - Storefront → Web API and BFF: uses API
README.md - Web API and BFF → Commerce API: routes requests
README.md - Customer API → Identity service: proxies customer actions
README.md - Commerce API → Orders and finance: handles domain requests
README.md - Orders and finance → Commerce database: reads and writes
README.md - Commerce API → Webhook inbox: accepts webhooks
services/commerce/src/app/api/webhooks/payops/route.ts - Webhook inbox → Orders and finance: settles payments
services/commerce/src/lib/webhooks.ts - Identity service → Identity database: stores accounts and carts
services/identity/server.mjs - Gateway API → API key auth: authenticates requests
services/gateway/src/server.js - Gateway API → Payment processing: dispatches payment calls
services/gateway/src/server.js - Gateway API → Hosted checkout: serves checkout
services/gateway/src/server.js - Gateway API → Gateway database: initializes store
services/gateway/src/server.js - Payment processing → Simulated connectors: routes transactions
services/gateway/src/payments.js - Payment processing → Webhook delivery: emits events
services/gateway/src/payments.js - Hosted checkout → Payment processing: confirms payment
services/gateway/src/pay-page.js - Webhook delivery → Webhook inbox: posts signed events
README.md - Commerce API → Gateway API: requests payment
README.md - Invoice proxy → External PayOps: fetches invoice
services/web/src/app/api/invoice/route.ts - Maintenance worker → Commerce API: calls maintenance
README.md