Skip to content

1 Architecture

Oussama Elhadji edited this page Nov 7, 2026 · 1 revision

Architecture & Engineering Design

LKHODRA (الخضرة والغلة) is architected as an offline-first, client-rendered Progressive Web App (PWA) built with React 19, TypeScript 5.9, Vite 8, and Tailwind CSS v4, delivering sub-second filtering across 100+ botanical species, 12-month & 4-season organ chronobiology schedules, and 8 Moroccan agricultural terroirs.

flowchart TD
    User([User in Moroccan Souk / Kitchen / Clinic]) --> UI[LKHODRA React 19 UI]
    UI --> ChronoModule[4-Season & 12-Month Organ Chronobiology Deck]
    UI --> CatalogModule[100+ Moroccan & World Produce Encyclopedia]
    UI --> TerroirModule[8-Region Moroccan Agro-Climatic GIS Map]
    UI --> HealthModule[9-Organ Clinical Bio-Apothecary Explorer]
    UI --> QoffaModule[Souk Qoffa Budget & Macro Comparator]
    UI --> SpeechModule[Darija & Amazigh Web Speech Synthesizer]

    ChronoModule --> SeasonalDB[(seasonalOrgans.ts & monthlyOrgans.ts)]
    CatalogModule --> ProduceDB[(produce.ts + verifiedProduceImages.ts)]
    CatalogModule --> LocalImg[(108 Local Botanical Images /public/images/produce/)]

    UI --> AgroAPIs[Live Agro-Botanical Telemetry: Open-Meteo / GBIF / OpenFoodFacts]
    UI --> PWA[Workbox Service Worker Precache - 100% Offline Ready]
Loading

🏛️ Core Architectural Layers

1. Nocturnal Moroccan Oasis & Bioluminescent Bio-Apothecary Design System (src/index.css)

  • Color Tokens:
    • --bg-void: #050b07 (Deep Nocturnal Oasis Obsidian)
    • --bg-surface: #0a140e (Chlorophyll Herbarium Card Surface)
    • --accent-emerald: #10b981 / #34d399 (Bioluminescent Chloroplast)
    • --accent-saffron: #f59e0b (Taliouine Saffron Gold)
    • --accent-ruby: #f43f5e (Sefri Pomegranate Ruby)
  • Arabic Cursive Typography Integrity:
    • Uses Cairo and Tajawal for Arabic/Darija headlines and clinical copy alongside Syne, Outfit, Fraunces, and JetBrains Mono for Latin/scientific telemetry.
    • Enforces html[dir="rtl"] * { letter-spacing: 0 !important; font-feature-settings: "kern" 1, "liga" 1, "calt" 1; } so Arabic letters never disconnect or fragment.
  • Zero-Overlap Herbarium Plate Layout (src/components/ProduceCard.tsx):
    • Stacks the Weekly Schedule Badge, Target Weak Organ Title, and Clinical Explanation into dedicated full-width rows with break-words so RTL/LTR text never collides on mobile or desktop viewports.

2. Dual-Mode Organ Chronobiology Engine (src/data/seasonalOrgans.ts & src/data/monthlyOrgans.ts)

  • 4-Season Mode: Maps winter, spring, summer, and autumn to their climate-stressed organs and a 4-week seasonal recovery protocol.
  • 12-Month Mode: Maps every calendar month (1 January through 12 December) and its traditional Moroccan Fellahi solar period (الليالي, العزارة, الحسومة, نيسان, العنصرة, الصمايم, أكتوبر الفلاحي) to the primary and secondary vulnerable organs of that exact month and a 4-week monthly nutritional schedule.

3. Verified Local & Commons Image Pipeline (scripts/fetch-all-produce-images.ts)

  • Queries the Wikipedia pageimages API and Wikimedia Commons API using each item's exact binomial scientific name (scientificName).
  • Downloads all 108 primary species images locally to public/images/produce/<id>-1.jpg and generates src/data/verifiedProduceImages.ts with 3 non-repetitive photos per species and automatic onError local fallback.

Clone this wiki locally