How devbassel/saas_commerce works
saas_commerce is a multi-tenant SaaS commerce platform: customers browse tenant storefronts and shop, store teams manage commerce and subscriptions, and platform operators administer tenants and plans. The principal flow runs from storefront or dashboard requests through the API’s tenant-aware authentication and domain services to tenant data and external payment/storage services. The README documents major capabilities that are not fully represented in the excerpts; those branches are included, but their internal call paths are not inferred.
Main entry points: subscription.service.ts Plans and Entitlements · auth.service.ts Authentication · main.ts NestJS API · products.service.ts Product Catalog
Components 22
Customer and Admin Apps
- Customer Storefront
apps/tenant_store - Store Admin Dashboard
apps/store_owner_dashboard/src/App.tsx - Platform Admin Console
apps/super_admin_dashboard/src/App.tsx
Identity and Tenancy
- Authentication
apps/api/src/modules/auth/auth.service.ts - User and RBAC
apps/api/src/modules/users/users.service.ts - Tenant Lifecycle
apps/api/src/modules/tenants/services/tenant-manager.service.ts - Tenant Scoping
apps/api/src/modules/tenants/utils/tenant-scope.ts - Email Verification
apps/api/src/modules/email-otp/email-otp.service.ts
Commerce Operations
- Product Catalog
apps/api/src/modules/products/products.service.ts - Categories
apps/api/src/modules/categories/categories.service.ts - Shopping Cart
apps/api/src/modules/cart/cart.service.ts - Orders and Checkout
apps/api/src/modules/orders/orders.service.ts - Coupons
apps/api/src/modules/coupons/coupons.service.ts
Platform Services
- Plans and Entitlements
apps/api/src/modules/subscriptions/services/subscription.service.ts - Stripe Payments
apps/api/src/modules/payments/stripe.payment.service.ts - Tenant File Storage
apps/api/src/common/storage/r2.service.ts
Data and Integrations
- NestJS API
apps/api/src/main.ts - Tenant PostgreSQL Schemas
apps/api/src/common/config/data-source.factory.ts - Response Cache
apps/api/src/common/cache/tenant-cache.service.ts - Stripe
- Cloudflare R2
Other components
- Store Customer
Connections 18
- Store Customer → Customer Storefront: browses and shops
- Customer Storefront → NestJS API: requests catalog and cart
- Store Admin Dashboard → NestJS API: manages store
- Platform Admin Console → NestJS API: administers platform
- Authentication → User and RBAC: creates and looks up users
apps/api/src/modules/auth/auth.service.ts - Authentication → Tenant Lifecycle: provisions tenants
apps/api/src/modules/auth/auth.service.ts - Authentication → Plans and Entitlements: checks subscription
apps/api/src/modules/auth/auth.service.ts - Authentication → Email Verification: requests and verifies OTP
apps/api/src/modules/auth/auth.service.ts - Product Catalog → Tenant PostgreSQL Schemas: uses tenant data
- Orders and Checkout → Stripe Payments: processes payments
- Stripe Payments → Stripe: integrates with
- Tenant File Storage → Cloudflare R2: stores tenant files
- Plans and Entitlements → Tenant PostgreSQL Schemas: stores plans and usage
- Product Catalog → Response Cache: caches tenant reads
- Product Catalog → Plans and Entitlements: enforces product limits
- Coupons → Plans and Entitlements: enforces coupon entitlements
- Orders and Checkout → Plans and Entitlements: enforces checkout limits
- NestJS API → Tenant Scoping: resolves tenant context