Skip to content

A comprehensive web dashboard application built with Flutter for tracking and managing coffee plantations in Koraput. The application provides real-time monitoring, data visualization, and management tools for coffee plantation initiatives.

License

Notifications You must be signed in to change notification settings

amrit-dash/coffee-mapper-web

Coffee Mapper Web Dashboard 🌱☕

Coffee Mapper Logo

A comprehensive web dashboard application built with Flutter for tracking and managing coffee plantations in Koraput. The application provides real-time monitoring, data visualization, and management tools for coffee plantation initiatives.

Flutter Dart Firebase License PRs Developer Twitter Follow Build

FeaturesInstallationContributingSupport

🌐 Live Deployments

Production Development

Try out our Production Environment or Development Environment

✨ Features

Dashboard Preview

📊 Real-time Dashboard

  • 📈 Live metrics and statistics
  • 📊 Interactive data visualization
  • 🎯 Comprehensive plantation overview
  • 📱 Progress tracking and monitoring

🌿 Plantation Management

  • ☕ Coffee plantation tracking
  • 🌳 Shade tree management
  • 📏 Area and perimeter calculations
  • 🗺️ Geolocation mapping

📋 Data Filtering & Analysis

  • 🔍 Multi-level filtering (District, Block, Village, Panchayat)
  • 📑 Region-based categorization
  • 📊 Performance metrics
  • 📈 Survival rate tracking

👥 User Management

  • 🔐 Secure authentication
  • 👮 Role-based access control
  • 👨‍💼 Admin dashboard
  • 📝 User activity tracking

🗺️ Interactive Maps

  • 🌍 Google Maps integration
  • 📍 Polygon visualization
  • 🚩 Boundary mapping
  • 📌 Location-based insights

📸 Media Management

  • 🖼️ Image galleries
  • 📄 Documentation storage
  • 📸 Boundary images
  • 📹 Progress documentation

🚀 Getting Started

Prerequisites

Before you begin, ensure you have the following installed:

  • Flutter SDK (^3.5.4)
  • Dart SDK (^3.0.0)
  • Firebase CLI
  • A Google Maps API key
  • Git

🔑 API Keys and Configuration

  1. Firebase Setup:

    • Create two Firebase projects (development and production)
    • Enable Authentication, Firestore, and Hosting
    • Set up Firebase configuration:
      # Copy template files
      cp .github/templates/firebase.json.template firebase.json
      cp .github/templates/firestore.rules.template firestore.rules
      cp .github/templates/storage.rules.template storage.rules
      cp .github/templates/firestore.indexes.json.template firestore.indexes.json
      cp .github/templates/.firebaserc.template .firebaserc
    • Update the configuration files:
      • In firebase.json:
        • Replace your-site-name with your Firebase hosting site name
        • Update your-region with your preferred region (e.g., "asia-east1")
      • In .firebaserc:
        • Replace your-project-id with your default Firebase project ID
        • Update your-dev-project-id and your-prod-project-id with your development and production project IDs
        • Configure hosting targets for your sites
      • Update security rules in firestore.rules and storage.rules:
        • Replace the default open access rules with your security requirements
        • Uncomment and modify the example secured rules as needed
      • In firestore.indexes.json:
        • Replace the example index with your required Firestore indexes
        • Add additional indexes as needed for your queries
  2. Google Maps Setup:

    • Create a Google Cloud Project
    • Enable Maps JavaScript API
    • Create API key with appropriate restrictions
    • Add the key to your environment configuration

⚡ Quick Start

  1. Clone the repository:

    git clone https://github.com/amrit-dash/coffee-mapper-web.git
    cd coffee_mapper_web
  2. Install dependencies:

    flutter pub get
  3. Configure Firebase:

    cp lib/config/firebase_options_dev.template.dart lib/config/firebase_options_dev.dart
    cp lib/config/firebase_options_prod.template.dart lib/config/firebase_options_prod.dart
  4. Set up environment variables:

    cp .env.template .env

    Update the following in your .env file:

    GOOGLE_MAPS_API_KEY=your_api_key
    FIREBASE_API_KEY=your_firebase_key
    
  5. Run the application:

    flutter run -d chrome

🔧 Environment Setup

Development Environment

# Install Firebase tools
npm install -g firebase-tools

# Login to Firebase
firebase login

# Initialize Firebase
firebase init

# Select features:
# - Firestore
# - Hosting
# - Authentication

Production Environment

# Deploy to production
./deploy.sh prod

# Deploy to development
./deploy.sh dev
📱 Supported Platforms
Platform Support
Web
Android 🚧
iOS 🚧
Windows
macOS
Linux

🔧 Development vs Production

The application supports both development and production environments:

🛠️ Development

./deploy.sh dev

🚀 Production

./deploy.sh prod
  • Uses production Firebase project
  • Optimized performance
  • Production-specific security rules
  • Live at: coffeemapper.web.app

🏗️ Project Structure

lib/
├── config/          # ⚙️ Configuration files
├── models/          # 📦 Data models
├── screens/         # 📱 Application screens
├── services/        # 🔧 Business logic and API services
├── utils/          # 🛠️ Utility functions
└── widgets/        # 🎨 Reusable UI components
    ├── dialogs/    # 💬 Dialog components
    ├── forms/      # 📝 Form components
    ├── layout/     # 🎯 Layout components
    ├── map/        # 🗺️ Map-related components
    └── tables/     # 📊 Data table components

🔒 Security

  • 🔐 Firebase Authentication for user management
  • 🔑 Secure API key handling
  • 🛡️ Environment-specific security rules
  • 🔒 Data access control
  • 🔄 Regular security updates

⚠️ Important Security Note: The template files in .github/templates/ contain open access rules for demonstration purposes only. Never use these rules in production. Always implement proper security rules based on your application's requirements before deploying.

🤝 Contributing

We love your input! Check out our Contributing Guidelines to get started.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

👥 Core Team

🙏 Acknowledgments

  • 🎯 Flutter Team for the amazing framework
  • 🔥 Firebase for backend services
  • 🗺️ Google Maps Platform for mapping services

🔧 Technical Details

📝 Firestore Rules Configuration

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    // Common functions
    function isAuthenticated() {
      return request.auth != null;
    }
    
    function isAdmin() {
      return isAuthenticated() && 
        get(/databases/$(database)/documents/admins/$(request.auth.uid)).data != null;
    }

    // Collection access rules
    match /plantations/{document=**} {
      allow read: if isAuthenticated();
      allow write: if isAdmin();
    }
    
    match /metrics/{document=**} {
      allow read: if isAuthenticated();
      allow write: if isAdmin();
    }
    
    match /users/{userId} {
      allow read: if isAuthenticated() && (request.auth.uid == userId || isAdmin());
      allow write: if isAdmin();
    }
  }
}

🚀 Deployment Process

Development Deployment

# 1. Build the web app
flutter build web --web-renderer canvaskit --release --dart-define=ENVIRONMENT=development

# 2. Deploy to Firebase Hosting (Development)
firebase use development
firebase deploy --only hosting

# Alternative: Use deployment script
./deploy.sh dev

Production Deployment

# 1. Build the web app with optimizations
flutter build web --web-renderer canvaskit --release --dart-define=ENVIRONMENT=production

# 2. Deploy to Firebase Hosting (Production)
firebase use production
firebase deploy --only hosting

# Alternative: Use deployment script
./deploy.sh prod

🧪 Testing Guidelines

Unit Tests

// Example test structure
void main() {
  group('Plantation Service Tests', () {
    late PlantationService plantationService;
    
    setUp(() {
      plantationService = PlantationService();
    });
    
    test('should calculate area correctly', () {
      final coordinates = [
        LatLng(0, 0),
        LatLng(0, 1),
        LatLng(1, 1),
        LatLng(1, 0),
      ];
      
      final area = plantationService.calculateArea(coordinates);
      expect(area, closeTo(111.32, 0.01));
    });
  });
}

Integration Tests

# Run integration tests
flutter drive --driver=test_driver/integration_test.dart --target=integration_test/app_test.dart -d chrome

Performance Testing

# Run performance tests
flutter run --profile --trace-skia

Test Coverage

# Generate coverage report
flutter test --coverage
genhtml coverage/lcov.info -o coverage/html

📞 Support

For support and inquiries:


Made with ❤️ for Koraput's Coffee Farming Community

Website

About

A comprehensive web dashboard application built with Flutter for tracking and managing coffee plantations in Koraput. The application provides real-time monitoring, data visualization, and management tools for coffee plantation initiatives.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks