A modern, scalable e-commerce platform built with microservices architecture, featuring multiple backend frameworks, dual database systems, and real-time communication.
This project implements a microservices architecture with 7 services:
- 5 Backend Services (using different frameworks)
- 2 Frontend Applications (client and admin)
| Service | Framework | Database | Purpose |
|---|---|---|---|
| Auth Service | Express.js | - | User authentication & authorization |
| Product Service | Express.js | PostgreSQL + Prisma | Product & category management |
| Order Service | Fastify | MongoDB + Mongoose | Order processing & management |
| Payment Service | Hono | - | Stripe payment integration |
| Email Service | Node.js | - | Email notifications via Kafka |
| Application | Framework | Purpose | Port |
|---|---|---|---|
| Client | Next.js 15 | Customer-facing e-commerce store | 3002 |
| Admin | Next.js 15 | Administrative dashboard | 3003 |
- Frameworks: Express.js, Fastify, Hono
- Databases: PostgreSQL (with Prisma ORM), MongoDB (with Mongoose)
- Authentication: Clerk
- Payment Processing: Stripe
- Message Queue: Apache Kafka
- Email: Nodemailer
- Framework: Next.js 15 with React 19
- Styling: Tailwind CSS
- UI Components: Radix UI, Lucide React
- State Management: Zustand
- Forms: React Hook Form + Zod validation
- Charts: Recharts
- Payment: Stripe React components
- Monorepo: Turborepo + pnpm workspaces
- Containerization: Docker
- TypeScript: Full type safety across all services
- Linting: ESLint with custom configurations
- Code Formatting: Prettier
micro/
βββ apps/ # Applications
β βββ admin/ # Admin dashboard (Next.js)
β βββ client/ # Customer store (Next.js)
β βββ auth-service/ # Authentication service (Express)
β βββ product-service/ # Product management (Express)
β βββ order-service/ # Order processing (Fastify)
β βββ payment-service/ # Payment handling (Hono)
β βββ email-service/ # Email notifications
βββ packages/ # Shared packages
β βββ kafka/ # Kafka client & configuration
β βββ product-db/ # PostgreSQL + Prisma
β βββ order-db/ # MongoDB + Mongoose
β βββ types/ # Shared TypeScript types
β βββ eslint-config/ # ESLint configurations
β βββ typescript-config/ # TypeScript configurations
βββ docker-compose.yml # Kafka infrastructure
- Node.js >= 18
- pnpm 9.0.0
- Docker & Docker Compose
- PostgreSQL database
- MongoDB database
-
Clone the repository
git clone <your-repo-url> cd micro
-
Install dependencies
pnpm install
-
Start Kafka infrastructure
cd packages/kafka docker-compose up -d -
Set up environment variables Create
.envfiles in each service directory with required environment variables:- Database URLs (PostgreSQL & MongoDB)
- Clerk authentication keys
- Stripe API keys
- Email service credentials
-
Run database migrations
# For PostgreSQL (Product service) cd packages/product-db pnpm prisma migrate dev
-
Start all services
# From root directory pnpm dev
# Start specific services
pnpm --filter client dev # Client app (port 3002)
pnpm --filter admin dev # Admin app (port 3003)
pnpm --filter auth-service dev # Auth service
pnpm --filter product-service dev # Product service
pnpm --filter order-service dev # Order service
pnpm --filter payment-service dev # Payment service
pnpm --filter email-service dev # Email service# Development
pnpm dev # Start all services in development mode
pnpm build # Build all applications
pnpm lint # Lint all packages
pnpm format # Format code with Prettier
pnpm check-types # Type check all packages
# Database
pnpm db:generate # Generate Prisma client
pnpm db:migrate # Run database migrations
pnpm db:deploy # Deploy database schema- Client Store: http://localhost:3002
- Admin Dashboard: http://localhost:3003
- Auth Service: Handles user authentication
- Product Service: Manages products and categories
- Order Service: Processes orders and order history
- Payment Service: Handles Stripe payments
- Email Service: Sends transactional emails
- Kafka UI: http://localhost:8080 (Kafka management interface)
- Synchronous: REST APIs for direct service communication
- Asynchronous: Apache Kafka for event-driven communication
- Authentication: Clerk for centralized auth across all services
- Products: Product information, pricing, images, variants
- Categories: Product categorization and organization
- Orders: Order details, status, user information, product items
- Stripe: Full payment processing with webhooks
- Payment Methods: Credit cards, digital wallets
- Order Management: Automatic order creation on successful payment
- Transactional Emails: Order confirmations, shipping updates
- Event-Driven: Triggered via Kafka events
- Template System: Customizable email templates
Kafka infrastructure is containerized with Docker Compose:
- Zookeeper
- Kafka broker
- Kafka UI for management
- Authentication: Clerk-based authentication
- Authorization: Role-based access control
- API Security: CORS, input validation
- Payment Security: Stripe's secure payment processing
- Hot Reload: All services support hot reloading
- Type Safety: Full TypeScript coverage
- Code Quality: ESLint, Prettier, and type checking
- Monorepo: Efficient dependency management with pnpm workspaces
- Kafka UI: Real-time message monitoring
- Service Health: Individual service health checks
- Error Handling: Comprehensive error handling across services
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
This project is licensed under the ISC License.
- Add comprehensive testing suite
- Implement service mesh (Istio)
- Add monitoring and logging (Prometheus, Grafana)
- Implement caching layer (Redis)
- Add API documentation (Swagger/OpenAPI)
- Implement CI/CD pipeline
- Add performance monitoring
- Implement rate limiting
- Add comprehensive error tracking
Built with β€οΈ using modern microservices architecture