https://github.com/hasnaintypes/shopra-monorepo
Shopra Monorepo – A scalable multi-tenant e-commerce SaaS marketplace with modular Next.js frontends and NestJS microservices. Supports sellers, customers, and admins with real-time features, personalized recommendations, and a modern, event-driven architecture.
https://github.com/hasnaintypes/shopra-monorepo
e-commerce event-driven firebase full-stack kafka microservices mongodb monorepo multi-tenant nestjs nextjs pnpm pnpm-workspace prisma-orm redis saas shadcn-ui typescript
Last synced: 3 months ago
JSON representation
Shopra Monorepo – A scalable multi-tenant e-commerce SaaS marketplace with modular Next.js frontends and NestJS microservices. Supports sellers, customers, and admins with real-time features, personalized recommendations, and a modern, event-driven architecture.
- Host: GitHub
- URL: https://github.com/hasnaintypes/shopra-monorepo
- Owner: hasnaintypes
- License: mit
- Created: 2025-08-31T18:39:52.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2025-09-19T10:06:31.000Z (10 months ago)
- Last Synced: 2025-09-19T12:27:54.126Z (10 months ago)
- Topics: e-commerce, event-driven, firebase, full-stack, kafka, microservices, mongodb, monorepo, multi-tenant, nestjs, nextjs, pnpm, pnpm-workspace, prisma-orm, redis, saas, shadcn-ui, typescript
- Language: TypeScript
- Homepage:
- Size: 1.63 MB
- Stars: 1
- Watchers: 0
- Forks: 2
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Shopra Monorepo
> **Shopra** a multi-tenant SaaS marketplace platform built with a modular **monorepo** architecture.
> Developed and maintained by [@hasnaintypes](https://github.com/hasnaintypes).
---
## Project Overview
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.
---
## Core Features
- **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.
---
## Tech Stack
### Frontend
[](https://nextjs.org/)
[](https://react.dev/)
[](https://tailwindcss.com/)
[](https://ui.shadcn.com/)
### Backend
[](https://nestjs.com/)
[](https://kafka.apache.org/)
[](https://redis.io/)
[](https://www.mongodb.com/)
[](https://www.prisma.io/)
### Infrastructure & Tooling
[](https://pnpm.io/)
[](https://github.com/features/actions)
[](https://www.docker.com/)
---
## Monorepo Structure
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
```
---
## Architectural Principles
- **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.
---
## Kafka Event Flows
- **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.
---
## Next.js App Structure
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
```
---
## Setup & Installation
### 1. Clone the Repository
```bash
git clone https://github.com/hasnaintypes/shopra-monorepo.git
cd shopra-monorepo
```
### 2. Install Dependencies
```bash
pnpm install
```
### 3. Environment Variables
Create `.env` files for apps and services.
See **[Environment Setup](#-environment-variables)** for details.
### 4. Run Development Servers
```bash
pnpm dev
```
---
## Deployment
- **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.
---
## Environment Variables
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`)
---
## Testing
- **Unit Tests**: Each service has a `test/unit` folder.
- **E2E Tests**: Located in `test/e2e` inside services.
- **CI Integration**: Tests run automatically in GitHub Actions.
---
## Roadmap
- [ ] Multi-currency support
- [ ] Multi-language support
- [ ] Analytics dashboard for sellers
- [ ] AI-powered fraud detection
---
## Contributing
Contributions are welcome!
1. Fork the repo
2. Create a feature branch
3. Submit a Pull Request
---
## License
[MIT](./LICENSE) © [@hasnaintypes](https://github.com/hasnaintypes)
---