Files
backend/CONTEXT.md
T

1.3 KiB

Mana Collection Backend — Context

Product

Multi-seller fashion marketplace. Each seller is a Store with one STORE_ADMIN owner.

Future dashboards:

  • store.manacollections.ir — store admin
  • customer.manacollections.ir — customer
  • admin.manacollections.ir — super admin

Patterns (from Mado Motor)

  • Nest 11, Prisma 6, bcrypt, passport-jwt
  • Meshkee SMS (MESHKEE_SMS_*)
  • Parspack S3 with project prefix mana-collection/ (Mado uses mado-motor/)
  • Opaque refresh tokens (hashed in DB), JWT access with { sub, role, storeId? }
  • OTP: SHA-256 hash, 6 digits, 5 min TTL, 60s resend, 5 attempts

Store lifecycle

  1. Public storeRegister OTP → creates User(STORE_ADMIN) + Store(pending)
  2. Super admin sets status active (or rejected with reason)
  3. Pending store: only GET/PATCH /stores/me
  4. Active store: full products/categories/brands/blogs/orders/customers CRUD

Multi-store orders

Order can span multiple stores via OrderItem.storeId and per-store OrderStoreFulfillment. Store admins see only their items + update their fulfillment status. Super admin manages overall Order.status.

Catalog variants

Categories hold colors[], sizes[], packages[] (catalog ids). Products have nested ProductVariant rows with colorId / sizeId / packageId + prices. Static catalogs exposed at /catalog.