How sopet-co-ltd/new-sopet-backend works
SOPET Backend is a NestJS GraphQL API for a multi-vendor commerce platform, with limited REST endpoints for webhooks and vendor integrations. The principal customer flow is authenticate, discover products, manage a cart, place an order, pay, and track fulfillment; vendors manage stores, catalog and fulfillment, while admins oversee platform operations. The graph also preserves documented search, reviews, promotions, payouts, uploads, and transactional email. README documents the resolver-to-service-to-PostgreSQL pattern; sampled code confirms selected module responsibilities, but not every module-to-module connection.
Main entry points: graphql.module.ts GraphQL API · database.module.ts PostgreSQL · public-api.controller.ts Vendor public API · orders.service.ts Order management
Components 22
API and identity
- GraphQL API
src/graphql/graphql.module.ts - Vendor public API
src/modules/public-api/public-api.controller.ts - Authentication
src/modules/auth/auth.service.ts
Commerce workflow
- Product catalog
src/modules/products/products.service.ts - Smart search
src/modules/search/search.service.ts - Shopping cart
src/modules/cart/cart.service.ts - Order management
src/modules/orders/orders.service.ts - Order fulfillment
src/modules/orders/order-fulfillment.service.ts - Payments
src/modules/payments/payments.service.ts - Multi-vendor stores
src/modules/stores/stores.service.ts
Platform capabilities
- Promotions and sales
src/modules/promotions/promotions.service.ts - Reviews
src/modules/reviews/reviews.service.ts - Vendor payouts
src/modules/payouts/payouts.service.ts - Analytics
src/modules/analytics/analytics.service.ts - Image uploads
src/modules/storage/storage.resolver.ts - Transactional email
src/modules/email/email.service.ts
Persistence and runtime
- PostgreSQL
src/database/database.module.ts - Redis and BullMQ
src/modules/queue/queue.module.ts
Other components
- Customer or vendor
- Omise gateway
- S3-compatible storage
- Resend
Connections 36
- Customer or vendor → GraphQL API: sends requests
- GraphQL API → Authentication: dispatches auth
- GraphQL API → Product catalog: dispatches catalog
- GraphQL API → Smart search: dispatches search
- GraphQL API → Shopping cart: dispatches cart
- GraphQL API → Order management: dispatches orders
- GraphQL API → Payments: dispatches payments
- GraphQL API → Multi-vendor stores: dispatches store ops
- GraphQL API → Promotions and sales: dispatches promotions
- GraphQL API → Reviews: dispatches reviews
- GraphQL API → Vendor payouts: dispatches payouts
- GraphQL API → Analytics: dispatches analytics
- GraphQL API → Image uploads: dispatches uploads
- Vendor public API → Product catalog: calls catalog
- Vendor public API → Order management: calls orders
- Vendor public API → Order fulfillment: calls fulfillment
- Vendor public API → Reviews: calls reviews
- Vendor public API → Analytics: calls analytics
- Vendor public API → Multi-vendor stores: imports store data
- Order management → Order fulfillment: delegates fulfillment
- Payments → Omise gateway: integrates payments
- Image uploads → S3-compatible storage: uploads images
- Transactional email → Resend: sends email
- Smart search → Redis and BullMQ: queues embeddings
- Authentication → PostgreSQL: reads and writes
- Product catalog → PostgreSQL: reads and writes
- Smart search → PostgreSQL: queries catalog
- Shopping cart → PostgreSQL: reads and writes
- Order management → PostgreSQL: reads and writes
- Order fulfillment → PostgreSQL: updates orders
- Payments → PostgreSQL: records payments
- Multi-vendor stores → PostgreSQL: reads and writes
- Promotions and sales → PostgreSQL: reads and writes
- Reviews → PostgreSQL: reads and writes
- Vendor payouts → PostgreSQL: reads and writes
- Analytics → PostgreSQL: queries metrics