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!