Shopra a multi-tenant SaaS marketplace platform built with a modular monorepo architecture.
Developed and maintained by @hasnaintypes.
Shopra is a modern multi-tenant e-commerce SaaS platform designed to empower independent sellers while offering a seamless shopping experience to end-users. The project adopts a microservices architecture with Next.js frontends for different stakeholders and NestJS services for the backend.
It enables sellers to create and manage their stores independently, users to shop across a dynamic marketplace, and administrators to monitor and manage the ecosystem efficiently.
-
Multi-Tenant SaaS Model
Independent sellers onboard, list products, manage inventory, and fulfill orders. -
Personalized Shopping Experience
Real-time recommendations powered by TensorFlow. -
Real-Time Chat
WebSocket-based communication between sellers and customers. -
Event-Driven Microservices
Asynchronous communication powered by Kafka. -
Scalable Infrastructure
Built with NestJS microservices, MongoDB, and Redis caching. -
Role-Based Access Control
Sellers, users, and admins operate via dedicated frontends with centralized authentication.
The repository follows a pnpm workspace monorepo structure with separation between apps, backend services, and shared libraries.
shopra-monorepo/
├── apps/
│ ├── web/ # Next.js app — User/Customer-facing UI
│ ├── seller-portal/ # Next.js app — Seller dashboard
│ ├── admin-panel/ # Next.js app — Admin dashboard
│
├── services/
│ ├── api-gateway/ # NestJS API Gateway
│ ├── svc-auth/ # Authentication & authorization
│ ├── svc-product/ # Product management service
│ ├── svc-order/ # Order processing & fulfillment
│ ├── svc-recommendation/ # TensorFlow-powered recommendations
│ ├── svc-chat/ # Real-time WebSocket chat
│ ├── svc-user/ # User profile management
│ ├── svc-notifications/ # Notifications (push/email)
│
├── libs/
│ ├── ui/ # Shared UI components (Shadcn wrappers, design system)
│ ├── shared-types/ # Common TypeScript types & interfaces
│ ├── kafka-client/ # Reusable Kafka producer/consumer
│ ├── logging-lib/ # Centralized logging utility
│ ├── prisma-client/ # Centralized Prisma client
│
├── .github/ # GitHub workflows (CI/CD)
├── .husky/ # Git hooks (Prettier, linting, tests)
├── .vscode/ # Recommended settings & extensions
├── package.json
├── pnpm-workspace.yaml # PNPM workspace configuration
├── tsconfig.json
└── README.md
- Domain-Driven Design (DDD): Each service encapsulates a specific domain (auth, product, order, etc.).
- Microservices: Services are loosely coupled and communicate via Kafka events.
- Event-Driven: Kafka ensures reliable, asynchronous communication across services.
- Separation of Concerns: Apps (UI), services (backend), and libs (shared code) are modular and independently deployable.
- Scalability: Each service can be scaled independently based on load.
- OrderCreated → Product Service: Update inventory asynchronously.
- OrderCreated → Notifications Service: Send push/email notifications.
- ProductViewed / ProductPurchased → Recommendation Service: Update recommendation models in real-time.
- Chat Messages → Notifications Service: Notify participants of new messages.
Each app (web, seller-portal, admin-panel) follows the App Router with feature-based modularity.
/apps/web/
├── src/
│ ├── app/ # Next.js App Router (public/protected routes)
│ ├── components/ # Reusable components
│ ├── lib/ # Client utilities & hooks
│ ├── styles/ # Global & theme styles
├── public/ # Static assets
git clone https://github.com/hasnaintypes/shopra-monorepo.git
cd shopra-monorepopnpm installCreate .env files for apps and services.
See Environment Setup for details.
pnpm dev- Frontend Apps: Deployable on Vercel, Netlify, or Docker.
- Backend Services: Deployable on Kubernetes, Docker Swarm, or standalone containers.
- CI/CD: GitHub Actions workflows handle build, linting, testing, and deployment pipelines.
Each service and app requires environment configuration.
Define variables in .env files (not included in the repo).
Sections to add later:
- API Gateway
- Authentication Service
- Product Service
- Order Service
- Recommendation Service
- Chat Service
- Notifications Service
- Frontend Apps (
web,seller-portal,admin-panel)
- Unit Tests: Each service has a
test/unitfolder. - E2E Tests: Located in
test/e2einside services. - CI Integration: Tests run automatically in GitHub Actions.
- Multi-currency support
- Multi-language support
- Analytics dashboard for sellers
- AI-powered fraud detection
Contributions are welcome!
- Fork the repo
- Create a feature branch
- Submit a Pull Request