An open API service indexing awesome lists of open source software.

https://github.com/coding4deep/ecommerce-microservice


https://github.com/coding4deep/ecommerce-microservice

Last synced: 7 months ago
JSON representation

Awesome Lists containing this project

README

          

# πŸ›οΈ Enterprise E-Commerce Microservices Platform

A comprehensive, production-ready e-commerce platform built with modern microservices architecture, featuring real-time notifications, advanced user management, product reviews, inventory tracking, and responsive web interfaces.

## πŸ—οΈ Architecture Overview

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ FRONTEND LAYER β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Web App (React) β”‚ Admin Panel (React) β”‚
β”‚ Port: 3000 β”‚ Port: 3001 β”‚
β”‚ - User Interface β”‚ - Admin Dashboard β”‚
β”‚ - Product Catalog β”‚ - User Management β”‚
β”‚ - Shopping Cart β”‚ - Analytics β”‚
β”‚ - User Dashboard β”‚ - System Monitoring β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ API GATEWAY (Nginx) β”‚
β”‚ Port: 8080 β”‚
β”‚ - Load Balancing - Rate Limiting - Health Checks β”‚
β”‚ - Request Routing - SSL Termination - CORS Handling β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ MICROSERVICES LAYER β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ User Service β”‚ Product Service β”‚ Cart Service β”‚
β”‚ (Python/FastAPI) β”‚ (Java/Spring) β”‚ (Node.js/Express) β”‚
β”‚ Port: 8001 β”‚ Port: 8002 β”‚ Port: 8003 β”‚
β”‚ - Authentication β”‚ - Product CRUD β”‚ - Shopping Cart β”‚
β”‚ - User Profiles β”‚ - Categories β”‚ - Session Management β”‚
β”‚ - JWT Tokens β”‚ - Search/Filter β”‚ - Cart Persistence β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Notification β”‚ Review Service β”‚ Inventory Service β”‚
β”‚ Service β”‚ (Node.js) β”‚ (Node.js) β”‚
β”‚ (Node.js) β”‚ Port: 8006 β”‚ Port: 8007 β”‚
β”‚ Port: 8005 β”‚ - Product Reviewsβ”‚ - Stock Management β”‚
β”‚ - Email/SMS/Push β”‚ - Rating System β”‚ - Stock Reservations β”‚
β”‚ - Real-time β”‚ - Review Moderationβ”‚ - Low Stock Alerts β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Admin Service β”‚ β”‚
β”‚ (Go/Gin) β”‚ β”‚
β”‚ Port: 8009 β”‚ β”‚
β”‚ - Admin Panel APIβ”‚ β”‚
β”‚ - User Managementβ”‚ β”‚
β”‚ - System Analyticsβ”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ DATA LAYER β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ MongoDB β”‚ Redis Cache β”‚ HashiCorp Vault β”‚
β”‚ Port: 27017 β”‚ Port: 6379 β”‚ Port: 8200 β”‚
β”‚ - Primary DB β”‚ - Session Store β”‚ - Secrets Management β”‚
β”‚ - Document Store β”‚ - Cache Layer β”‚ - API Keys β”‚
β”‚ - Replica Sets β”‚ - Pub/Sub β”‚ - Certificates β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

## πŸš€ Features

### πŸ›’ **E-Commerce Core**
- **Product Management**: 32+ sample products across 5 categories
- **Shopping Cart**: Persistent cart with session management
- **User Authentication**: JWT-based auth with refresh tokens
- **Order Processing**: Complete order lifecycle management
- **Payment Integration**: Ready for Stripe/PayPal integration

### πŸ‘₯ **User Experience**
- **Responsive Design**: Mobile-first, works on all devices
- **User Dashboard**: Personal stats, order history, profile management
- **Product Reviews**: 5-star rating system with image uploads
- **Real-time Notifications**: Email, SMS, and push notifications
- **Advanced Search**: Filter by category, price, brand, ratings

### πŸ”§ **Admin Features**
- **Admin Dashboard**: Real-time analytics and system monitoring
- **User Management**: CRUD operations on user accounts
- **Product Management**: Add, edit, delete products and categories
- **Order Management**: Track and update order statuses
- **System Health**: Monitor all microservices health

### πŸ“Š **Enterprise Features**
- **Microservices Architecture**: Scalable, maintainable, fault-tolerant
- **Real-time Updates**: WebSocket connections for live data
- **Inventory Management**: Stock tracking with automatic reservations
- **Notification System**: Multi-channel communication
- **Security**: JWT tokens, rate limiting, input validation
- **Monitoring**: Health checks, logging, error tracking

## πŸ› οΈ Technology Stack

### **Frontend**
- **React 18**: Modern UI library with hooks
- **React Router**: Client-side routing
- **Axios**: HTTP client for API calls
- **CSS3**: Custom responsive styling
- **Socket.IO Client**: Real-time communication

### **Backend Services**
- **Python/FastAPI**: User service with async support
- **Java/Spring Boot**: Product service with JPA
- **Node.js/Express**: Cart, notification, review, inventory services
- **Go/Gin**: Admin service for high performance
- **Nginx**: API Gateway and load balancer

### **Databases & Storage**
- **MongoDB**: Primary database for all services
- **Redis**: Caching and session storage
- **HashiCorp Vault**: Secrets management

### **DevOps & Infrastructure**
- **Docker**: Containerization for all services
- **Docker Compose**: Local development orchestration
- **Kubernetes**: Production deployment (configs included)
- **Health Checks**: Built-in monitoring for all services

## πŸš€ Quick Start

### Prerequisites
- Docker & Docker Compose
- Node.js 18+ (for development)
- Git

### 1. Clone Repository
```bash
git clone
cd ecommerce-microservices
```

### 2. Start All Services
```bash
docker-compose up -d
```

### 3. Initialize Sample Data
```bash
node create-sample-products.js
```

### 4. Access Applications
- **Web App**: http://localhost:3000
- **Admin Panel**: http://localhost:3001
- **API Gateway**: http://localhost:8080

### 5. Default Credentials
**Admin User:**
- Email: `admin@example.com`
- Password: `admin123`

**Demo User:**
- Email: `demo@example.com`
- Password: `demo12345`

## πŸ“ Project Structure

```
ecommerce-microservices/
β”œβ”€β”€ frontend/
β”‚ β”œβ”€β”€ web-app/ # React customer app
β”‚ └── admin-app/ # React admin panel
β”œβ”€β”€ services/
β”‚ β”œβ”€β”€ user-service/ # Python/FastAPI
β”‚ β”œβ”€β”€ product-service/ # Java/Spring Boot
β”‚ β”œβ”€β”€ cart-service/ # Node.js/Express
β”‚ β”œβ”€β”€ notification-service/ # Node.js/Express
β”‚ β”œβ”€β”€ review-service/ # Node.js/Express
β”‚ β”œβ”€β”€ inventory-service/ # Node.js/Express
β”‚ β”œβ”€β”€ admin-service/ # Go/Gin
β”‚ └── api-gateway/ # Nginx
β”œβ”€β”€ k8s/ # Kubernetes manifests
β”œβ”€β”€ data/ # Database initialization
β”œβ”€β”€ docker-compose.yml # Development setup
└── README.md # This file
```

## πŸ”§ Development

### Running Individual Services
```bash
# User Service
cd services/user-service
python -m uvicorn src.main:app --reload --port 8001

# Product Service
cd services/product-service
./mvnw spring-boot:run

# Cart Service
cd services/cart-service
npm install && npm run dev
```

### Environment Variables
Each service uses environment variables for configuration. See individual service README files for details.

### Database Setup
MongoDB is automatically initialized with sample data. To reset:
```bash
docker-compose down -v
docker-compose up -d
node create-sample-products.js
```

## πŸ§ͺ Testing

### Manual Testing
1. **User Flow**: Register β†’ Login β†’ Browse Products β†’ Add to Cart β†’ Checkout
2. **Admin Flow**: Login β†’ Dashboard β†’ Manage Users β†’ Manage Products
3. **API Testing**: Use Postman collection (included in `/docs`)

### Health Checks
```bash
# Check all services
curl http://localhost:8080/health

# Individual services
curl http://localhost:8001/health # User Service
curl http://localhost:8002/products/health # Product Service
curl http://localhost:8003/health # Cart Service
```

## πŸš€ Production Deployment

### Kubernetes
```bash
# Apply all manifests
kubectl apply -f k8s/

# Check deployment status
kubectl get pods -n ecommerce
```

### Docker Swarm
```bash
# Initialize swarm
docker swarm init

# Deploy stack
docker stack deploy -c docker-compose.yml ecommerce
```

### Environment Configuration
- Set production environment variables
- Configure external databases
- Set up SSL certificates
- Configure monitoring and logging

## πŸ“Š Monitoring & Observability

### Health Endpoints
- All services expose `/health` endpoints
- API Gateway aggregates health status
- Built-in service discovery

### Logging
- Structured JSON logging
- Centralized log aggregation ready
- Error tracking and alerting

### Metrics
- Performance metrics collection
- Business metrics tracking
- Real-time dashboards ready

## πŸ”’ Security

### Authentication & Authorization
- JWT-based authentication
- Role-based access control (RBAC)
- Secure password hashing
- Session management

### API Security
- Rate limiting on all endpoints
- Input validation and sanitization
- CORS configuration
- SQL injection prevention

### Infrastructure Security
- Secrets management with Vault
- Network isolation
- Container security scanning
- Regular security updates

## 🀝 Contributing

1. Fork the repository
2. Create feature branch (`git checkout -b feature/amazing-feature`)
3. Commit changes (`git commit -m 'Add amazing feature'`)
4. Push to branch (`git push origin feature/amazing-feature`)
5. Open Pull Request

### Development Guidelines
- Follow service-specific coding standards
- Write comprehensive tests
- Update documentation
- Ensure backward compatibility

## πŸ“„ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## πŸ†˜ Support

### Documentation
- [API Documentation](docs/api.md)
- [Deployment Guide](docs/deployment.md)
- [Troubleshooting](docs/troubleshooting.md)

### Getting Help
- Create an issue for bugs
- Use discussions for questions
- Check existing documentation first

## 🎯 Roadmap

### Phase 1 (Current)
- βœ… Core e-commerce functionality
- βœ… Microservices architecture
- βœ… Admin panel
- βœ… Real-time notifications

### Phase 2 (Planned)
- [ ] Payment gateway integration
- [ ] Advanced analytics
- [ ] Mobile app (React Native)
- [ ] AI-powered recommendations

### Phase 3 (Future)
- [ ] Multi-tenant support
- [ ] Advanced reporting
- [ ] Third-party integrations
- [ ] Machine learning features

---

**Built with ❀️ for modern e-commerce needs**

*This platform demonstrates enterprise-grade microservices architecture with real-world features and production-ready code.*