Bazaar is a next-generation, microservices-based e-commerce platform built using multiple frameworks and databases, all orchestrated with a Turborepo monorepo. It demonstrates real-world distributed architecture — event-driven communication, polyglot persistence, and framework interoperability.
🧠 The goal: showcase how different technologies (Express, Fastify, Hono, Next.js, Kafka, Stripe, Clerk, etc.) can cohesively form a modular, scalable, event-driven e-commerce system.
┌────────────────────┐
│ Web (Next.js) │
└─────────┬──────────┘
│
┌──────────────────────────┼───────────────────────────┐───────────────────────────┐
▼ ▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌────────────────┐ ┌─────────────────┐
│ Product Svc │──Kafka──▶│ Order Svc │──Kafka─ ─▶│ Email Svc │──Kafka──▶│ Payment Svc │──Stripe Webhook──▶ Payment Success
│ (Express + │ │ (Fastify + │ │ (Worker + Kafka│ │ (Hono + Stripe │
│ PostgreSQL) │ │ MongoDB) │ │ Consumers) │ | ) |
└──────────────┘ └──────────────┘ └────────────────┘ └─────────────────┘
▲
│
│
│
│
│
│
│
│
▼
┌──────────────┐
│ Auth Svc │──Clerk API──▶ User Authentication
└──────────────┘
bazaar/
├── apps/
│ ├── web/ # Next.js storefront (user-facing)
│ ├── admin/ # Next.js admin dashboard
│ ├── product-service/ # Express + TypeScript + PostgreSQL (via Prisma)
│ ├── order-service/ # Fastify + TypeScript + MongoDB (via Mongoose)
│ ├── payment-service/ # Hono + TypeScript + Stripe integration
│ ├── auth-service/ # Express + TypeScript + Clerk authentication
│ └── email-service/ # Kafka consumers for transactional emails
│
├── packages/
│ ├── kafka/ # Kafka setup (producer/consumer utilities)
│ ├── product-db/ # Prisma + NeonDB client
│ ├── order-db/ # Mongoose + MongoDB connection
│ └── types/ # Shared TypeScript types across services
│
└── turbo.json
| Service | Framework | Database | Description |
|---|---|---|---|
| 🛒 Product Service | Express | PostgreSQL (via Prisma) | Manages products, CRUD ops, and publishes Kafka events |
| 📦 Order Service | Fastify | MongoDB (via Mongoose) | Handles order creation/retrieval, consumes & emits Kafka events |
| 💳 Payment Service | Hono | — | Integrates with Stripe APIs and webhooks for payment flow |
| 👤 Auth Service | Express | Clerk | Manages user retrieval and authentication |
| ✉️ Email Service | Node (Kafka Worker) | — | Subscribes to user.created & order.created for emails |
| App | Framework | Purpose |
|---|---|---|
| 🏪 Web App | Next.js | Customer-facing storefront (products, checkout, etc.) |
| 🧑💼 Admin Panel | Next.js | Dashboard to manage products, orders, and payments |
| Package | Purpose |
|---|---|
| 🧭 kafka | Central Kafka setup and utilities |
| 🧩 product-db | Prisma + NeonDB connection for product data |
| 🧱 order-db | MongoDB connection and Mongoose models |
| 🧾 types | Shared TypeScript types between services |
- 🧩 Polyglot Microservices: Each service uses a unique framework and database.
- ⚡ Event-Driven Architecture: Kafka enables async communication and decoupling.
- 🧰 Turborepo Monorepo: Enables isolated builds and shared dependency management.
- 🔒 Decoupled Auth: Clerk ensures secure authentication across apps.
- 💳 Modern Payments: Stripe webhook for
checkout.session.completedevent.
# Clone the repo
git clone https://github.com/muditkalra/microservices-ecommerce.git
cd microservices-ecommerce
# Install dependencies
pnpm install
# Start Kafka (via Docker Compose)
cd packages/kafka
docker compose up -d
# Run a specific service (example: product-service)
pnpm --filter product-service dev
# Or run all apps & services
pnpm run dev
⚠️ Configure.envfiles for each app (Stripe, Clerk, databases, etc.) before running.
- API Gateway / GraphQL BFF
- Redis caching layer
- gRPC inter-service communication
- Prometheus + Grafana monitoring
- CI/CD with GitHub Actions
- Background worker optimizations
| Layer | Technologies |
|---|---|
| Frontend | Next.js (App Router, TypeScript) |
| Backend | Express, Fastify, Hono |
| Databases | PostgreSQL (Prisma), MongoDB (Mongoose), NeonDB |
| Auth | Clerk |
| Payments | Stripe |
| Messaging | Kafka |
| Repo Management | Turborepo + PNPM |
| Language | TypeScript |
| Infrastructure | Docker Compose (WIP) |
✅ Real-world microservices communication using Kafka
✅ Handling different databases per service (polyglot persistence)
✅ Clean service isolation via Turborepo
✅ Seamless third-party API integration (Stripe, Clerk)
✅ Event-driven flow with async reliability
Mudit Kalra
Fullstack & Systems Design Enthusiast
Building scalable distributed systems with Node.js, Kafka, and Next.js
🚧 In active development — evolving toward a fully distributed, event-driven e-commerce ecosystem.
⭐ Star this repo if you find the architecture inspiring!