Cherry là hệ thống đặt đồ ăn nhanh được phát triển theo kiến trúc Microservices với .NET 8, được chia thành 4 giai đoạn phát triển để quản lý tốt hơn quá trình phát triển, kiểm thử và triển khai.
Mục tiêu: Xây dựng API quản lý sản phẩm cơ bản
Services:
- ProductAPI
- SQL Server Database
Timeline: 1-2 tuần Difficulty: ⭐⭐
Deliverables:
- CRUD API cho sản phẩm
- Database với Products table
- Swagger documentation
- Unit & Integration tests
Mục tiêu: Thêm giỏ hàng và hệ thống mã giảm giá
Services:
- ProductAPI (từ Phase 1)
- ShoppingCartAPI
- CouponAPI
- SQL Server Database
Timeline: 2-3 tuần Difficulty: ⭐⭐⭐
Deliverables:
- Cart management API
- Coupon system
- Service integration tests
- Workflow testing
Mục tiêu: Xác thực người dùng và xử lý đơn hàng
Services:
- All Phase 2 services
- AuthAPI (JWT)
- OrderAPI
- SQL Server Database
Timeline: 3-4 tuần Difficulty: ⭐⭐⭐⭐
Deliverables:
- JWT authentication
- Role-based authorization
- Order processing
- Security tests
- E2E workflow tests
Mục tiêu: Hoàn thiện hệ thống với Frontend, Gateway, Email, Rewards
Services:
- All Phase 3 services
- EmailAPI
- RewardAPI
- API Gateway (Ocelot)
- Cherry.Web (Frontend)
Timeline: 4-5 tuần Difficulty: ⭐⭐⭐⭐⭐
Deliverables:
- Complete web application
- API Gateway
- Email notifications
- Reward points system
- E2E tests
- Production deployment
Prerequisites:
- Docker & Docker Compose
- .NET 8 SDK (cho development)
- Git
# Phase 1
./scripts/run-phase.sh 1
# Phase 2
./scripts/run-phase.sh 2
# Phase 3
./scripts/run-phase.sh 3
# Phase 4 (Complete system)
./scripts/run-phase.sh 4./scripts/build-phase.sh <phase_number> <version>
# Ví dụ:
./scripts/build-phase.sh 1 v1.0./scripts/run-tests.sh <phase_number> [test_type]
# Ví dụ:
./scripts/run-tests.sh 1 unit
./scripts/run-tests.sh 2 all./scripts/stop-phase.sh <phase_number>FastFoodOrder/
├── Cherry.Services.AuthAPI/ # Phase 3
├── Cherry.Services.ProductAPI/ # Phase 1
├── Cherry.Services.CouponAPI/ # Phase 2
├── Cherry.Services.ShoppingCartAPI/ # Phase 2
├── Cherry.Services.OrderAPI/ # Phase 3
├── Cherry.Services.EmailAPI/ # Phase 4
├── Cherry.Services.RewardAPI/ # Phase 4
├── Cherry.GatewaySolution/ # Phase 4
├── Cherry.Web/ # Phase 4
├── docker/
│ └── phases/
│ ├── docker-compose.phase1.yml
│ ├── docker-compose.phase2.yml
│ ├── docker-compose.phase3.yml
│ └── docker-compose.phase4.yml
├── scripts/
│ ├── build-phase.sh
│ ├── run-phase.sh
│ ├── stop-phase.sh
│ ├── run-tests.sh
│ └── deploy-phase.sh
├── .github/workflows/
│ ├── phase1-ci.yml
│ ├── phase2-ci.yml
│ ├── phase3-ci.yml
│ └── phase4-ci.yml
└── docs/
├── PHASE_DEVELOPMENT_GUIDE.md
└── phases/
├── phase1/README.md
├── phase2/README.md
├── phase3/README.md
└── phase4/README.md
| Phase | Unit Tests | Integration Tests | E2E Tests | Coverage |
|---|---|---|---|---|
| Phase 1 | ✅ | ✅ | - | ≥ 70% |
| Phase 2 | ✅ | ✅ | - | ≥ 75% |
| Phase 3 | ✅ | ✅ | ✅ | ≥ 80% |
| Phase 4 | ✅ | ✅ | ✅ | ≥ 80% |
- Unit Tests: Service logic, business rules
- Integration Tests: API endpoints, database
- E2E Tests: Complete user workflows
- Security Tests: Authentication, authorization, SQL injection, XSS
- Performance Tests: Load testing, response time
cherry-productapi:v1.0-phase1
cherry-productapi:v2.0-phase2cherry-couponapi:v2.0-phase2cherry-shoppingcartapi:v2.0-phase2
cherry-authapi:v3.0-phase3cherry-orderapi:v3.0-phase3- (+ all Phase 2 services)
cherry-gateway:v4.0-phase4cherry-web:v4.0-phase4cherry-emailapi:v4.0-phase4cherry-rewardapi:v4.0-phase4- (+ all Phase 3 services)
main- Production branchphase1-product-management- Phase 1 developmentphase2-cart-coupons- Phase 2 developmentphase3-auth-orders- Phase 3 developmentphase4-complete-system- Phase 4 development
v1.0-phase1,v1.1-phase1- Phase 1 releasesv2.0-phase2,v2.1-phase2- Phase 2 releasesv3.0-phase3,v3.1-phase3- Phase 3 releasesv4.0-phase4,v4.1-phase4- Phase 4 releases
Mỗi phase có workflow riêng:
- phase1-ci.yml: Build & test ProductAPI
- phase2-ci.yml: Build & test all Phase 2 services
- phase3-ci.yml: Build, test & security scan Phase 3
- phase4-ci.yml: Build, test & deploy complete system
- Checkout code
- Setup .NET 8
- Restore dependencies
- Build projects
- Run tests
- Build Docker images
- Push to Docker Hub (on tag)
- Deploy to production (Phase 4 only)
- ProductAPI:
http://localhost:5002
- ProductAPI:
http://localhost:5002 - CouponAPI:
http://localhost:5003 - ShoppingCartAPI:
http://localhost:5004
- AuthAPI:
http://localhost:5001 - OrderAPI:
http://localhost:5005 - (+ all Phase 2 services)
- Web Application:
http://localhost:5008 - API Gateway:
http://localhost:5000 - EmailAPI:
http://localhost:5006 - RewardAPI:
http://localhost:5007 - (+ all Phase 3 services)
- 📖 Hướng dẫn phát triển theo phases
- 📖 Phase 1: Product Management
- 📖 Phase 2: Cart & Coupons
- 📖 Phase 3: Auth & Orders
- 📖 Phase 4: Complete System
- 📖 Báo cáo dự án
Sau khi hoàn thành 4 phases, bạn sẽ học được:
- ✅ Microservices Architecture: Thiết kế và triển khai microservices
- ✅ Docker & Containerization: Build và deploy containers
- ✅ API Development: RESTful API với .NET 8
- ✅ Authentication & Authorization: JWT, Role-based access
- ✅ Testing: Unit, Integration, E2E, Security testing
- ✅ CI/CD: Automated build, test, deployment
- ✅ Database Design: SQL Server, Entity Framework Core
- ✅ API Gateway: Ocelot routing
- ✅ Frontend Development: ASP.NET MVC/Razor Pages
- ✅ DevOps: Monitoring, logging, deployment
lsof -i :5002
./scripts/stop-phase.sh <phase_number>docker-compose -f docker/phases/docker-compose.phase1.yml restart cherry-dbdocker builder prune
docker-compose -f docker/phases/docker-compose.phase1.yml build --no-cache- Phát triển: [Your Name]
- Giảng viên hướng dẫn: [Instructor Name]
This project is for educational purposes.
Happy Coding! 🚀
Nếu gặp vấn đề:
- Kiểm tra logs:
docker-compose logs - Xem documentation trong
docs/ - Tạo issue trên GitHub
- Liên hệ giảng viên
Project Timeline: 10-14 tuần (2.5-3.5 tháng)
Last Updated: 2025-10-07