Architecture Overview
Platform Description
MLM platform with Investment Marketplace, Product Marketplace, and MLM Admin Panel.
Tech Stack
- Frontend: React + TypeScript
- Backend: Node.js + TypeScript (NestJS)
- Database: PostgreSQL with ltree extension
- Cache: Redis (optional, for sessions/rate limiting)
- Queue: pg-boss (PostgreSQL-native)
Project Structure
iwm-platform/
├── apps/
│ ├── api/ # Backend API (NestJS)
│ │ ├── src/
│ │ │ ├── core/ # Framework-agnostic core
│ │ │ │ ├── domain/ # Base classes, interfaces
│ │ │ │ ├── errors/ # Domain errors
│ │ │ │ └── utils/ # Pure utility functions
│ │ │ │
│ │ │ ├── shared/ # Cross-cutting modules
│ │ │ │ ├── auth/ # JWT, 2FA, sessions
│ │ │ │ ├── users/ # User management
│ │ │ │ ├── notifications/ # Email, SMS, in-app
│ │ │ │ └── referral/ # Attribution tracking
│ │ │ │
│ │ │ ├── modules/ # Business modules
│ │ │ │ ├── investment/ # Investment marketplace
│ │ │ │ ├── product/ # E-commerce module
│ │ │ │ └── mlm/ # MLM core (partners, commissions, ranks)
│ │ │ │
│ │ │ ├── infrastructure/ # External adapters
│ │ │ │ ├── database/ # Prisma config
│ │ │ │ ├── cache/ # Redis (optional)
│ │ │ │ ├── queue/ # pg-boss workers
│ │ │ │ ├── payments/ # Stripe, YooKassa adapters
│ │ │ │ ├── delivery/ # CDEK, DHL adapters
│ │ │ │ └── notifications/ # SendGrid, Twilio adapters
│ │ │ │
│ │ │ └── main.ts
│ │ │
│ │ ├── prisma/ # Database schema
│ │ └── package.json
│ │
│ └── web/ # Frontend (React)
│ ├── src/
│ │ ├── modules/
│ │ │ ├── investment/ # Investment UI
│ │ │ ├── product/ # E-commerce UI
│ │ │ └── mlm-admin/ # MLM dashboard UI
│ │ ├── shared/ # Shared components, hooks
│ │ └── App.tsx
│ └── package.json
│
├── packages/ # Shared packages (optional)
│ └── shared-types/ # TypeScript types/interfaces
│
└── docker-compose.yml