Ứng dụng dinh dưỡng cá nhân hóa dành cho thị trường Việt Nam, hỗ trợ theo dõi sức khỏe, quản lý nguyên liệu, gợi ý món ăn theo ngân sách và mục tiêu fitness, đồng thời hướng đến triển khai lên Google Play (CH Play).
- Quản lý hồ sơ & onboarding: Đăng ký/đăng nhập email hoặc Google, OTP xác thực, onboarding 5 bước (thông tin cơ bản, sức khỏe, mục tiêu, dị ứng, hồ sơ AI).
- Khám phá & gợi ý an toàn: Tìm món ăn/công thức/nguy liệu, lọc theo calo, đạm, giá, loại trừ dị ứng, gợi ý rule-based an toàn.
- Theo dõi dinh dưỡng: Ghi nhật ký bữa ăn, dashboard calo/macro ngày/tuần/tháng, cảnh báo lệch mục tiêu, theo dõi cân nặng.
- Kế hoạch bữa ăn: Tạo/sao chép/sửa thực đơn theo ngày, chuyển plan thành log, so sánh thực tế vs kế hoạch, streak.
- Gói dịch vụ & thanh toán: Xem gói, đăng ký/gia hạn/hủy, tích hợp thanh toán SePay.
- Trợ lý AI & thông báo: Chat AI tư vấn dinh dưỡng, nhắc nhở chuẩn bị nguyên liệu/bữa ăn, hộp thư thông báo.
Hệ thống gồm 2 phần chính:
- API Layer (
MenuGreen.API): ASP.NET Core Web API, JWT Auth, Swagger, CORS. - Business Logic Layer (
MenuGreen.BusinessLogicLayer): Services, validators, DTOs, công thức dinh dưỡng, rule-based recommendation, AI assistant logic. - Data Access Layer (
MenuGreen.DataAccessLayer): EF Core 9 + PostgreSQL, Repository/UnitOfWork, Fluent Configurations.
Luồng xử lý:
- Controller nhận HTTP request.
- Gọi service ở Business Logic Layer.
- Service dùng Repository/UnitOfWork truy cập DbContext.
- Trả về DTO/response cho client.
- Cross-platform mobile app (Android / iOS).
- Quản lý trạng thái:
provider. - UI theo feature folder structure, phân biệt rõ models / providers / repositories / views / widgets.
- Tích hợp Firebase: Auth, Storage, Messaging.
- Giao tiếp backend qua
ApiClient+ApiEndpoints, hỗ trợ override base URL bằng--dart-define=API_BASE_URL=....
| Vùng | Công nghệ |
|---|---|
| Backend | C# 13, .NET 9, ASP.NET Core Web API |
| Database | PostgreSQL, EF Core 9, Npgsql |
| Auth & Security | JWT Bearer, BCrypt.Net, Firebase Admin (Google sign-in) |
| Frontend | Flutter, Dart |
| State Management | Provider |
| Firebase | Auth, Storage, Messaging |
| Charts | fl_chart |
| Payment | SePay (QR + Webhook) |
| Cache | Redis (nếu có) / In-memory fallback |
MenuGreenSystem/
├── backend/
│ ├── MenuGreen.API/ # Entrypoint API, Controllers, Program.cs
│ ├── MenuGreen.BusinessLogicLayer/ # Services, DTOs, Interfaces
│ ├── MenuGreen.DataAccessLayer/ # DbContext, Entities, Repositories, Configurations
│ ├── database/ # SQL seed data
│ ├── MenuGreen.sln
│ └── run_seed_data.ps1
├── docs/
│ ├── 01-deployment/ # Tài liệu triển khai
│ ├── 02-ops/ # Vận hành & CI/CD
│ ├── 03-backend/ # Tài liệu backend
│ ├── lightsail-setup.md
│ ├── NUTRITION_CALCULATIONS_README.md
│ ├── README_AI_FEATURES_API.md
│ ├── README_BACKEND_OVERVIEW.md # Tổng quan backend chi tiết
│ ├── README_SYSTEM_WORKFLOWS_AND_FEATURE_IDEAS.md
│ ├── README_USER_WORKFLOW.md
│ └── README_WORKFLOW_API_STATUS.md
├── frontend/
│ ├── lib/
│ │ ├── core/ # Network, theme, utils, i18n
│ │ ├── features/ # Mỗi feature: auth, onboarding, discover, tracking, meal_plan, subscription, ai_assistant...
│ │ └── main.dart / app.dart
│ ├── android/, ios/, windows/, macos/, linux/
│ └── README.md # Hướng dẫn chạy Flutter
├── frontend-web/ # Next.js web app
├── monitoring/ # Prometheus, Grafana, Alertmanager
├── scripts/ # Scripts triển khai, ops, utilities
├── firebase/ # Firebase rules
├── docker-compose.yml # Local dev (postgres + api + nginx) — backend/docker-compose.yml
├── docker-compose.prod.yml # Production (api only) — SCP'd by CD workflow
├── Dockerfile
├── .env.example
├── .env.production.example
└── README.md # Tài liệu dự án này
- .NET 9.0 SDK
- PostgreSQL
- Flutter SDK (đã thêm platform: android/ios/windows)
- PowerShell 5.1+ (để chạy script seed data)
- Git
git clone https://github.com/your-org/MenuGreenSystem.git
cd MenuGreenSystemMở backend/MenuGreen.API/appsettings.Development.json và backend/MenuGreen.API/appsettings.json, cập nhật ConnectionStrings:DefaultConnection cho môi trường local.
cd backend
dotnet tool install --global dotnet-ef
dotnet ef database update --project MenuGreen.DataAccessLayer --startup-project MenuGreen.APIScript PowerShell sẽ tự động kiểm tra/ tạo database rồi import các file SQL seed:
cd backend
PowerShell -ExecutionPolicy Bypass -File .\run_seed_data.ps1Trong script, chọn:
1: import vào Docker containermenugreen_db2: import vào PostgreSQL local (tự tạo DBMenuGreenDbnếu chưa có)3: gộp 55 file SQL thànhcombined_seed_data.sqlđể import thủ công
cd backend
dotnet run --project MenuGreen.APISwagger UI: http://localhost:5000/swagger
cd frontend
flutter pub get# Windows
flutter run -d windows
# Android emulator
flutter run -d emulator-5554
# iOS simulator
flutter run -d iPhone 15
# Chỉ build
flutter build apk # Android
flutter build ios # iOSFrontend đọc API_BASE_URL từ build-time define. Nếu không set, sẽ dùng giá trị mặc định trong code.
# Ví dụ: trỏ về backend local (Android emulator dùng 10.0.2.2)
flutter run -d emulator-5554 --dart-define=API_BASE_URL=http://10.0.2.2:5000/api
# iOS simulator / Windows
flutter run -d windows --dart-define=API_BASE_URL=http://localhost:5000/apiProduction API hiện tại: https://menugreensystem.onrender.com/api
| File | Nội dung |
|---|---|
docs/README_BACKEND_OVERVIEW.md |
Kiến trúc backend, entities, security, sample API |
docs/README_USER_WORKFLOW.md |
Chi tiết hành trình người dùng end-to-end |
docs/README_WORKFLOW_API_STATUS.md |
Trạng thái từng workflow: API + UI đã làm / còn thiếu |
docs/README_SYSTEM_WORKFLOWS_AND_FEATURE_IDEAS.md |
Ý tưởng hệ thống và roadmap tính năng |
frontend/README.md |
Hướng dẫn build/run Flutter |
Dự án đang trong giai đoạn phát triển chức năng cốt lõi và chuẩn bị cho CH Play. Các luồng chính hiện đã có backend API và phần lớn đã có UI Flutter tương ứng.
| Nhóm | Trạng thái |
|---|---|
| Auth, Onboarding, Profile, Health, Allergy | ✅ API + UI |
| Khám phá món ăn / công thức / nguyên liệu | ✅ API + UI |
| Gợi ý an toàn & Recommendation | 🟡 API sẵn, UI đang bổ sung |
| Nutrition Tracking + Weight Tracking | ✅ API + UI |
| Meal Plan | ✅ API + UI |
| Subscription & SePay | ✅ API + UI |
| Notification | ✅ API + UI |
| AI Assistant | 🟡 API sẵn, chat UI đang kết nối |
| Safety / Compliance / Vietnam-first nutrition | 🟡 API có, UI chưa phủ |
# Backend
cd backend
dotnet test
# Flutter
cd frontend
flutter analyze
flutter test- Backend: comment/biến/log viết tiếng Anh; message trả về client cũng dùng tiếng Anh.
- Flutter UI: nút, label, empty state, dialog viết tiếng Việt; dịch message API qua
ApiMessageTranslator/localizeAuthMessage. - Flutter: tuân thủ
constconstructor,ListView.builder+ValueKey, dispose controllers, dùngmountedtrước dùngcontextsau async. - Commit message: nên có tiền tố rõ ràng (
feat:,fix:,docs:,refactor:,test:,chore:).
- CORS đang mở AllowAll cho môi trường phát triển; cần siết chặt khi lên production.
- JWT secret, Firebase credential, database URL phải để trong environment variables / user secrets, không commit.
- Redis không bắt buộc; hệ thống tự fallback về in-memory cache nếu không cấu hình.
- Fork repository.
- Tạo branch feature (
git checkout -b feature/ten-tinh-nang). - Commit thay đổi (
git commit -m "feat: mo ta ngan gon"). - Push và tạo Pull Request.
MIT