Masjid ul Haram Waste Management Dashboard
freelance

Masjid ul Haram Waste Management Dashboard

Real-time Waste Monitoring System for the Grand Mosque

1 month
3
Next.js 15TypeScriptReact 18Tailwind CSSShadcn/uiFastifyLocal StorageWebSocket+2 more

A comprehensive, real-time waste management system specifically designed for Masjid ul Haram (the Grand Mosque) in Mecca, Saudi Arabia. This intelligent dashboard provides advanced monitoring, analytics, and management capabilities for waste collection operations during Hajj and Umrah seasons, ensuring cleanliness and operational efficiency in Islam's holiest site.

Key Features

Real-time Dashboard

Live monitoring dashboard built with Shadcn/ui components, featuring real-time statistics, interactive maps, and WebSocket-powered updates for comprehensive waste management oversight.

Smart Bin Management

Advanced waste bin monitoring with fill level tracking, status indicators, location mapping, and automated alerts for efficient collection scheduling.

Fleet Management

Comprehensive truck tracking and route optimization system designed for mosque traffic patterns with driver performance metrics and fuel monitoring.

Multi-language Support

Full Arabic (RTL) and English (LTR) language support with Islamic cultural considerations and proper typography for international staff accessibility.

Interactive Mapping

Leaflet-based interactive maps with mosque-specific zones, sacred area monitoring, heat maps, and efficient marker clustering for thousands of assets.

Environmental Calculator

Sustainability metrics calculator with carbon footprint analysis, treatment method optimization, and environmental impact reporting aligned with Islamic stewardship values.

Development Journey

Phase 1

Planning & Cultural Research

Conducted comprehensive requirements gathering for Masjid ul Haram operations, researched Islamic cultural considerations, and designed system architecture with Arabic RTL support.

Phase 2

Backend Development

Built robust Fastify server with TypeScript, implemented local data storage, developed JWT authentication, and created RESTful API endpoints for waste management operations.

Phase 3

Frontend & Real-time Features

Developed Next.js 15 frontend with TypeScript and Shadcn/ui components, implemented real-time WebSocket connections, created interactive Leaflet maps, and built comprehensive dashboard with multi-language support.

Phase 4

Testing & Deployment

Implemented comprehensive testing with Jest, optimized performance for 95+ Lighthouse scores, deployed with Docker containerization, and conducted security testing for production readiness.

Challenges & Solutions

Real-time Data Synchronization

Problem:

Managing real-time updates for thousands of waste bins across the mosque while ensuring data consistency and minimal latency with local storage during peak pilgrimage periods.

Solution:

Implemented WebSocket connections with fallback polling, efficient local storage management with data validation, and optimized caching strategies. Added circuit breaker patterns for resilient real-time data flow.

Multi-language & Cultural Integration

Problem:

Creating a system that respects Islamic values while providing seamless Arabic RTL and English LTR support, including proper typography and cultural considerations for sacred space operations.

Solution:

Integrated next-intl with custom RTL layouts, implemented Islamic calendar integration, prayer time coordination, and designed culturally sensitive UI components with proper Arabic typography.

Scalable Architecture & Performance

Problem:

Building a system capable of handling millions of pilgrims during Hajj season while maintaining sub-second response times and 95+ Lighthouse performance scores with local data storage.

Solution:

Implemented efficient local storage management with data caching strategies, Shadcn/ui for consistent design system, optimized state management, code splitting, and comprehensive performance monitoring.

waste-tracking.ts
typescript
// Real-time waste management system
interface WasteBin {
  id: string;
  location: { lat: number; lng: number };
  fillLevel: number;
  status: 'active' | 'maintenance' | 'full';
  lastUpdated: Date;
  type: 'general' | 'organic' | 'recyclable';
}

class WasteTrackingService {
  private ws: WebSocket;
  private bins: Map<string, WasteBin> = new Map();
  
  constructor(private apiUrl: string) {
    this.initializeWebSocket();
    this.loadInitialData();
  }
  
  private initializeWebSocket() {
    this.ws = new WebSocket(`wss://${this.apiUrl}/ws`);
    
    this.ws.onmessage = (event) => {
      export const update = JSON.parse(event.data);
      this.handleBinUpdate(update);
    };
    
    this.ws.onclose = () => {
      // Reconnect with exponential backoff
      setTimeout(() => this.initializeWebSocket(), 5000);
    };
  }
  
  private handleBinUpdate(update: Partial<WasteBin>) {
    export const existingBin = this.bins.get(update.id!);
    if (existingBin) {
      export const updatedBin = { ...existingBin, ...update };
      this.bins.set(update.id!, updatedBin);
      
      // Trigger UI updates for critical alerts
      if (updatedBin.fillLevel > 85) {
        this.triggerCollectionAlert(updatedBin);
      }
      
      this.updateDashboard(updatedBin);
    }
  }
  
  private async triggerCollectionAlert(bin: WasteBin) {
    // Send priority collection request for sacred areas
    if (this.isSacredArea(bin.location)) {
      await this.scheduleUrgentCollection(bin);
    }
  }
  
  private isSacredArea(location: { lat: number; lng: number }): boolean {
    // Check if bin is in Mataf, Safa & Marwa, or other sacred zones
    return this.isInMataf(location) || this.isInSafaMarwa(location);
  }
}