firebase integration
This commit is contained in:
@@ -28,6 +28,12 @@ Dieses Dokument enthält den aktuellen Entwicklungsstand und detaillierte Aufgab
|
||||
- Touch-Swipe-Karussell direkt auf index.php (unter Landing-Page)
|
||||
- Filteralgorithmus nach Benutzer-Ernährungszielen
|
||||
- Mikro-Animationen & Quick-Save Funktion
|
||||
- [/] **Phase 6: Firebase Firestore Datenbank-Migration & Seeding**
|
||||
- Firebase CLI-Login & Projekt-Initialisierung
|
||||
- .env-Konfiguration mit Firebase App Credentials
|
||||
- Client-seitiger "Seed Firestore"-Button in admin.php
|
||||
- Firestore REST API Integration in helpers.php
|
||||
- Echtzeit-Zwei-Wege-Sync bei Rezeptänderungen in admin.php
|
||||
|
||||
---
|
||||
|
||||
@@ -138,6 +144,29 @@ Ein hochgradig interaktives, touch-freundliches Karussell direkt auf der Startse
|
||||
|
||||
---
|
||||
|
||||
### 🔥 Phase 6: Firebase Firestore Datenbank-Migration & Seeding
|
||||
Migration des lokalen JSON-Flachdateispeichers auf eine skalierbare, cloudbasierte Firestore-Struktur.
|
||||
|
||||
- [/] **Firebase-Projekt & CLI-Setup**
|
||||
- [x] Firebase-Verzeichnis-Umgebung initialisieren und anbinden
|
||||
- [/] Firebase CLI Login durchführen und aktiven Account verknüpfen
|
||||
- [ ] Firebase Project & Web App ermitteln oder neu anlegen
|
||||
- [ ] Lokale `.env`-Konfiguration mit Firebase SDK Parametern befüllen
|
||||
- [ ] **Client-seitiges Daten-Seeding**
|
||||
- [ ] "Seed Firestore"-Aktion im Admin-Bereich (`admin.php`) einbauen
|
||||
- [ ] Batch-Dokumentenupload der `recipes.json`-Einträge in die Firestore Collection `recipes` über JS SDK
|
||||
- [ ] Firestore Security Rules für den öffentlichen Lesezugriff anpassen
|
||||
- [ ] **Firestore Server-seitiger Abruf (PHP REST API)**
|
||||
- [ ] Firestore REST API Parser-Helfer in `helpers.php` implementieren (Transformation von Firestore Key-Maps in Standard-Arrays)
|
||||
- [ ] `load_recipes()` auf REST API GET `/recipes` umstellen
|
||||
- [ ] Neue Funktion `load_recipe_by_slug($slug)` für gezielten Einzelabruf implementieren und in `recipe.php` integrieren
|
||||
- [ ] **Zwei-Wege-Echtzeit-Synchronisierung (Admin)**
|
||||
- [ ] `save_recipes()` so anpassen, dass lokales JSON als Fallback-Backup erhalten bleibt
|
||||
- [ ] Client-seitigen Trigger nach erfolgreichem PHP-Speichern in `admin.php` ausführen, um Änderungen sofort in Firestore zu spiegeln
|
||||
- [ ] Funktionstest: Hinzufügen, Editieren und Löschen von Rezepten über die Admin-Konsole verifizieren
|
||||
|
||||
---
|
||||
|
||||
## 📈 Status-Legende
|
||||
- `[ ]` Noch nicht begonnen
|
||||
- `[/]` In Bearbeitung
|
||||
|
||||
+5
-1
@@ -32,6 +32,10 @@ This document summarizes the architectural knowledge, conventions, and learnings
|
||||
## 5. Completed Milestones
|
||||
- **Phase 3 (Nutrition):** Implemented. Recipes now store `calories`, `protein`, `carbs`, and `fat`. Admin panel handles inputs, and the UI displays them beautifully.
|
||||
- **Phase 4 (Interactive Cooking Mode):** Implemented. Recipes now support step-by-step looping background videos and interactive timers (`step_videos`, `step_timers`). The UI utilizes a fullscreen overlay slider with Vanilla JS logic.
|
||||
- **Phase 6 (Firestore Database Migration):** Migrated recipes database from `data/recipes.json` to Firebase Firestore.
|
||||
- *Zero-Dependency REST API Read:* Server-side read requests in `helpers.php` use native PHP cURL to query the Firestore REST API `/documents/recipes`. Complex Firestore nested type maps are dynamically parsed into clean standard associative arrays using custom decoders.
|
||||
- *Dynamic Local Fallback:* In case of rate limits, network failures, or missing `.env` config, all lookup functions automatically fail back to the local `recipes.json` flat-file, guaranteeing 100% database availability and site resilience.
|
||||
- *Browser-Driven Seeding & Auto-Sync:* Admin seeding and real-time updates are executed client-side in `admin.php` via the authenticated Firebase Client SDK, keeping the local file and Cloud Firestore perfectly in sync without server-side OAuth2 keys.
|
||||
|
||||
## 6. Next Steps
|
||||
According to `TODO.md`, the next major feature block is **Phase 5 (PWA & Offline Support)**, which involves service workers, manifest files, and enabling the app to be installable on mobile devices.
|
||||
According to `TODO.md`, the next major feature block is completing the database seeding (by clicking "Seed Firestore" on `admin.php` in the browser) and verifying all recipe updates reflect in real-time. Afterwards, we can proceed to **Phase 5 (PWA & Offline Support)**.
|
||||
|
||||
Reference in New Issue
Block a user