MealDeal is a comprehensive food surplus redistribution platform that connects food providers (restaurants, cafes, bakeries) with consumers to reduce food waste and provide affordable meals. The platform includes a Flutter mobile app, PHP backend services, and a web admin dashboard.
- Dual Role System: Food providers and consumers with role-based interfaces
- Real-time Messaging: In-app chat system for communication
- Location Services: GPS-based pickup location management
- Image Upload: Photo capture for food listings
- Push Notifications: Real-time updates and alerts
- Order Management: Complete order lifecycle tracking
- Analytics Dashboard: Provider performance metrics
- User Management: Comprehensive user account administration
- Report System: Content moderation and user reporting
- Leaderboard: Gamified ranking system for top performers
- Impact Tracking: Food waste reduction metrics
- Pricing Control: Automated discount enforcement (50% minimum)
- Analytics: Real-time statistics and insights
- Firebase Integration: Cloud Firestore database
- Authentication: Secure user authentication and authorization
- API Endpoints: RESTful services for mobile and web clients
- Validation: Input validation and security measures
- File Management: Image upload and storage handling
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Flutter App β β Web Admin β β PHP Backend β
β (Mobile) βββββΊβ Dashboard βββββΊβ Services β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β
βββββββββββββββββββββββββΌββββββββββββββββββββββββ
β
βββββββββββββββββββ
β Firebase β
β (Database) β
βββββββββββββββββββ
MealDeal/
βββ flutter_application_1/ # Flutter mobile application
β βββ lib/
β β βββ features/ # Feature-based architecture
β β β βββ auth/ # Authentication screens & logic
β β β βββ consumer/ # Consumer-specific features
β β β βββ provider/ # Provider-specific features
β β β βββ messaging/ # Chat and messaging system
β β β βββ welcome/ # Onboarding screens
β β βββ services/ # Business logic services
β β β βββ firestore_helper.dart
β β β βββ geo_service.dart
β β β βββ location_service.dart
β β β βββ messaging_service.dart
β β β βββ routing_service.dart
β β βββ models/ # Data models
β β β βββ message.dart
β β βββ providers/ # State management providers
β β βββ screens/ # Screen components
β β βββ theme/ # App theming
β β β βββ app_theme.dart
β β βββ widgets/ # Reusable UI components
β β βββ firebase_options.dart # Firebase configuration
β β βββ main.dart # App entry point
β βββ android/ # Android platform configuration
β β βββ app/
β β β βββ build.gradle
β β β βββ google-services.json
β β β βββ src/ # Android source files
β β βββ gradle/ # Gradle wrapper
β βββ ios/ # iOS platform configuration
β β βββ Runner/
β β β βββ AppDelegate.swift
β β β βββ Assets.xcassets/
β β βββ Runner.xcodeproj/
β βββ web/ # Web platform files
β β βββ index.html
β β βββ manifest.json
β βββ backend/ # PHP backend services (legacy)
β β βββ auth/ # Authentication services
β β β βββ validate_role.php
β β βββ cart/ # Shopping cart logic
β β β βββ validate_checkout.php
β β βββ listings/ # Food listing management
β β β βββ report.php
β β β βββ safety_check.php
β β β βββ validate.php
β β βββ config/ # Firebase configuration
β β β βββ firebase_config.php
β β β βββ mealdeal-10385-firebase-adminsdk-*.json
β β βββ test/ # Backend tests
β βββ php_auth/ # PHP authentication module
β β βββ public/ # Public API endpoints
β β βββ src/ # Source files
β β β βββ AuthHandler.php
β β βββ config/ # Configuration
β βββ docs/ # Documentation
β βββ backups/ # Backup files
β βββ firebase.json # Firebase hosting config
β βββ firestore.rules # Firestore security rules
β βββ firestore.indexes.json # Firestore indexes
β βββ pubspec.yaml # Flutter dependencies
β βββ BUILD_APK_GUIDE.md # Build instructions
β βββ FIREBASE_VERIFICATION_SETUP.md
β βββ HOT_RELOAD_GUIDE.md
β βββ TROUBLESHOOTING.md
β
βββ web_admin/ # Web admin dashboard
β βββ assets/ # Static assets
β β βββ css/
β β β βββ admin.css # Centralized admin styles
β β βββ js/
β β βββ admin.js
β β βββ leaderboard.js # Leaderboard charts
β β βββ reports.js
β βββ api/ # API endpoints
β β βββ dashboard_stats.php
β β βββ get_ai_analysis.php
β β βββ get_comprehensive_stats.php
β β βββ get_disputes.php
β β βββ get_listings.php
β β βββ get_pricing_alerts.php
β β βββ get_recent_flags.php
β β βββ get_report_details.php
β β βββ get_user_contributions.php
β β βββ get_users.php
β βββ config/ # Configuration files
β β βββ database.php # Database configuration
β β βββ firebase-credentials.json
β βββ includes/ # Shared PHP includes
β β βββ auth.php # Authentication helpers
β β βββ cache.php # Caching functions
β β βββ data_functions.php # Data manipulation
β β βββ firestore_rest_adapter.php
β β βββ refresh_cache.php
β β βββ stats.php # Statistics functions
β βββ partials/ # Reusable partials
β β βββ header.php # Header navigation
β βββ cron/ # Scheduled tasks
β β βββ build_stats.php
β β βββ update_leaderboard_aggregates.php
β β βββ stats_cache.json
β βββ index.php # Main dashboard
β βββ dashboard.php # Dashboard page
β βββ login.php # Admin login
β βββ logout.php # Logout handler
β βββ users.php # User management
β βββ listings.php # Content moderation
β βββ reports.php # Report management
β βββ leaderboard.php # Leaderboard page
β βββ impact.php # Impact tracking
β βββ pricing.php # Pricing control
β βββ create_admin.php # Admin account creation
β βββ composer.json # PHP dependencies
β βββ README.md # Admin documentation
β
βββ CLEANUP_SUMMARY.md # Project cleanup notes
βββ README.md # This file
- Flutter SDK (3.6.0 or higher)
- Dart SDK (3.0.0 or higher)
- PHP (7.4 or higher)
- Composer (for PHP dependencies)
- Firebase Project with Firestore enabled
- Android Studio or Xcode (for mobile development)
git clone https://github.com/UNIIIIK/MealDeal.git
cd MealDealcd flutter_application_1
# Install Flutter dependencies
flutter pub get
# Configure Firebase
# 1. Create a Firebase project at https://console.firebase.google.com/
# 2. Enable Authentication and Firestore
# 3. Download google-services.json (Android) and GoogleService-Info.plist (iOS)
# 4. Place them in android/app/ and ios/Runner/ respectively
# Run the app
flutter runcd web_admin
# Install PHP dependencies
composer install
# Configure Firebase
# 1. Download Firebase service account key from Firebase Console
# 2. Save as config/firebase-credentials.json
# 3. Update config/database.php with your Firebase project ID
# Start local server
php -S localhost:8000cd backend
# Install PHP dependencies
composer install
# Configure Firebase credentials
# Copy your Firebase service account key to config/firebase-credentials.json-
Create Firebase Project:
- Go to Firebase Console
- Create a new project named "MealDeal"
- Enable Authentication (Email/Password)
- Enable Firestore Database
-
Configure Authentication:
- Enable Email/Password authentication
- Set up custom claims for user roles
- Configure security rules
-
Firestore Security Rules:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Users can read/write their own data
match /users/{userId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
// Listings are readable by all authenticated users
match /listings/{listingId} {
allow read: if request.auth != null;
allow write: if request.auth != null &&
request.auth.uid == resource.data.provider_id;
}
// Cart items are user-specific
match /cart/{cartId} {
allow read, write: if request.auth != null &&
request.auth.uid == resource.data.consumer_id;
}
}
}Create a .env file in the root directory:
FIREBASE_PROJECT_ID=your-project-id
FIREBASE_API_KEY=your-api-key
FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
FIREBASE_STORAGE_BUCKET=your-project.appspot.com- Create Listings: Upload photos and details of surplus food
- Manage Orders: Track and fulfill customer orders
- Analytics: View performance metrics and earnings
- Location Management: Set up pickup locations
- Messaging: Communicate with customers
- Browse Listings: Discover available food deals
- Place Orders: Add items to cart and checkout
- Track Orders: Monitor order status and pickup details
- Messaging: Chat with food providers
- Order History: View past purchases
- Real-time Statistics: User counts, active listings, reports
- Quick Actions: Review reports, manage users, moderate content
- Account Administration: View, edit, suspend user accounts
- Role Management: Assign provider/consumer roles
- Dispute Resolution: Handle user conflicts
- Report Review: Process user-generated reports
- Warning System: Issue warnings and bans
- Content Verification: Manual and automated checks
- Impact Metrics: Track food waste reduction
- User Engagement: Monitor platform usage
- Performance Reports: Generate insights and reports
- Authentication: Firebase Auth with custom claims
- Authorization: Role-based access control
- Input Validation: XSS and injection prevention
- File Upload Security: Image validation and virus scanning
- API Security: Rate limiting and request validation
- Data Encryption: Secure data transmission and storage
cd flutter_application_1
# Run unit tests
flutter test
# Run integration tests
flutter test integration_test/
# Run widget tests
flutter test test/cd backend
# Run PHP unit tests
vendor/bin/phpunit
# Test API endpoints
php test/firebase_test.phpcd flutter_application_1
# Build APK
flutter build apk --release
# Build App Bundle
flutter build appbundle --releasecd flutter_application_1
# Build iOS app
flutter build ios --release- Upload files to web server
- Configure web server (Apache/Nginx)
- Set up SSL certificate
- Configure environment variables
- Test all functionality
- Deploy PHP files to web server
- Configure PHP settings
- Set up cron jobs for scheduled tasks
- Monitor logs and performance
- Image Optimization: Compress and resize images
- Lazy Loading: Load content on demand
- Caching: Implement local caching strategies
- Code Splitting: Reduce app bundle size
- CDN: Use CDN for static assets
- Caching: Implement Redis/Memcached
- Database: Optimize Firestore queries
- Compression: Enable gzip compression
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
- Follow Flutter/Dart style guidelines
- Write comprehensive tests
- Update documentation
- Follow semantic versioning
- Use conventional commits
- β Basic mobile app functionality
- β Web admin dashboard
- β Firebase integration
- β User authentication
- π Push notifications
- π Payment integration
- π Advanced analytics
- π Multi-language support
- π AI-powered recommendations
- π Social features
- π API for third-party integrations
- π Advanced reporting tools
- Image upload may fail on slow connections
- Push notifications require device registration
- Some UI elements may not be fully responsive
- Offline functionality is limited
- Documentation: Check this README and inline code comments
- Email: sanchezjamesss02@gmail.com
This project is licensed under the MIT License - see the LICENSE file for details.
- Project Lead: Heinz Khervie Tobias
- Backend Development: Elizar James MuΓ±ez Sanchez
- Frontend Development: Emarie Dosdos Tulod
- System Analyst: Joshua Daligdig Cortes
- Languages: Dart (65.6%), PHP (24.3%), C++ (3.2%), JavaScript (1.4%)
- Lines of Code: 15,000+ lines
- Features: 25+ major features
- Platforms: Android, iOS, Web
- Database: Firebase Firestore
Built with β€οΈ for reducing food waste and helping the environment
MealDeal - Making surplus food accessible to everyone