MiniShop is a high-performance flash sale system built on a modern microservices architecture, designed to handle large-scale concurrent traffic. It incorporates flow control, graceful degradation, message queues, and distributed locking to effectively handle the challenges of flash sale scenarios.
- Go 1.21 β Main programming language, known for high performance in concurrent environments
- Gin β Lightweight HTTP framework for building RESTful APIs
- GORM β ORM library that simplifies database operations
- Redis β In-memory cache and distributed lock management; supports atomic Lua scripts
- PostgreSQL β Relational database providing strong ACID guarantees
- RabbitMQ / Kafka β Message queue systems for asynchronous traffic smoothing
- Docker β Containerization for consistent deployment
- Nginx β Reverse proxy and load balancer
- React 18 β Modern front-end framework
- TypeScript β Strongly-typed JavaScript for safer development
- Tailwind CSS β Utility-first CSS framework
- Zustand β Lightweight state management library
- TanStack Query β Data fetching and caching solution
- Axios β Promise-based HTTP client
- Prometheus + Grafana β Real-time monitoring and alerting
- Docker Compose β Local development environment orchestration
- Kubernetes (optional) β Production-level container orchestration support
- Atomic Stock Deduction β Redis Lua scripts ensure atomic inventory changes
- User Deduplication β Prevents duplicate purchases and overselling
- Asynchronous Order Processing β Order creation is handled via message queues for responsiveness
- Multi-level Rate Limiting β Token bucket, sliding window, and other strategies
- Circuit Breaker & Fallback β Automatic failure detection and service degradation
- Distributed Locking β Redis-based locking to avoid concurrent conflicts
- Eventual Consistency β Ensures Redis cache and PostgreSQL remain consistent
- Idempotent Design β Prevents duplicated operations under retry conditions
- Real-time Monitoring β Performance and health metrics available through Grafana dashboards
- Graceful Shutdown β Smooth restarts with resource cleanup
- Distributed Tracing β End-to-end request tracking across services
- API Gateway β Unified entry point for authentication, rate limiting, and routing
- Seckill Service β Core flash sale logic with high-concurrency handling
- Order Service β Asynchronous creation and management of orders
- Inventory Service β Manages stock consistency and synchronization
- Cache Service β Redis abstraction layer for locking and cache operations
- Atomic Stock Deduction β Redis Lua script prevents overselling
- Token Bucket Algorithm β Smooth rate limiting for burst traffic
- Circuit Breaker Pattern β Automatic fallback and degradation
- Asynchronous Queueing β Message queues buffer and smooth spikes
- Eventual Consistency β Cache and DB eventually synchronized
- Distributed Transactions β Cross-service coordination where needed
- Idempotency β Prevents duplicated operations on retries
- Compensation Mechanism β Fallback logic for retries or manual intervention
- Metrics Collection β Prometheus scrapes key system indicators
- Dashboard Visualization β Grafana displays real-time system health
- Health Checks β Liveness/readiness probes for each service
- Distributed Tracing β Track requests across service boundaries
- Countdown Timer β Millisecond-level accurate countdown for events
- Status Feedback β Clear success/failure indicators
- Responsive UI β Optimized for desktop and mobile
- Offline Support β PWA capabilities for offline access
- QPS: > 10,000 requests/second
- Concurrent Users: > 50,000
- Response Time: < 100ms (P99)
- Availability: > 99.9%
This project is licensed under the MIT License. See the LICENSE file for details.
π If you found this project helpful, please β it and share it with others!