- Created setup-directus-collections.js to automate the creation of tech stack collections, fields, and relations in Directus. - Created setup-directus-hobbies.js for setting up hobbies collection with translations. - Created setup-directus-projects.js for establishing projects collection with comprehensive fields and translations. - Added setup-tech-stack-directus.js to populate tech_stack_items with predefined data.
7.1 KiB
7.1 KiB
Directus Collections Struktur - Vollständige Portfolio Integration
🎯 Übersicht
Diese Struktur bildet alles aus deinem Portfolio in Directus ab, ohne Features zu verlieren.
📦 Collections
1. tech_stack_categories (Tech Stack Kategorien)
Felder:
id- UUID (Primary Key)key- String (unique) - z.B. "frontend", "backend"icon- String - Icon-Name (z.B. "Globe", "Server")sort- Integer - Reihenfolge der Anzeigestatus- String (draft/published/archived)translations- O2M zutech_stack_categories_translations
Translations (tech_stack_categories_translations):
id- UUIDtech_stack_categories_id- M2O zutech_stack_categorieslanguages_code- M2O zulanguages(de-DE, en-US)name- String - z.B. "Frontend & Mobile"
2. tech_stack_items (Tech Stack Items)
Felder:
id- UUID (Primary Key)category_id- M2O zutech_stack_categoriesname- String - z.B. "Next.js", "Docker", "Tailwind CSS"sort- Integer - Reihenfolge innerhalb der Kategorieurl- String (optional) - Link zur Technologie-Websiteicon_url- String (optional) - Custom Icon/Logo URL
Keine Translations nötig - Technologie-Namen bleiben gleich in allen Sprachen
3. projects (Projekte - Vollständig)
Felder:
id- UUID (Primary Key)slug- String (unique) - URL-freundlicher Identifierstatus- String (draft/published/archived)featured- Boolean - Hervorgehobenes Projektcategory- String - z.B. "Web Application", "Mobile App"date- String - Projektzeitraum (z.B. "2024", "2023-2024")github- String (optional) - GitHub Repository URLlive- String (optional) - Live Demo URLimage_url- String (optional) - Hauptbild des Projektsdemo_video- String (optional) - Video URLscreenshots- JSON - Array von Screenshot-URLscolor_scheme- String - Farbschema des Projektsaccessibility- Boolean - Barrierefreiheit vorhandendifficulty- String (Beginner/Intermediate/Advanced/Expert)time_to_complete- String - z.B. "4-6 weeks"technologies- JSON - Array von Technologienchallenges- JSON - Array von Herausforderungenlessons_learned- JSON - Array von Learningsfuture_improvements- JSON - Array von geplanten Verbesserungenperformance- JSON -{"lighthouse": 90, "bundleSize": "50KB", "loadTime": "1.5s"}analytics- JSON -{"views": 0, "likes": 0, "shares": 0}(read-only, kommt aus PostgreSQL)sort- Integerdate_created- DateTimedate_updated- DateTimetranslations- O2M zuprojects_translations
Translations (projects_translations):
id- UUIDprojects_id- M2O zuprojectslanguages_code- M2O zulanguagestitle- String - Projekttiteldescription- Text - Kurzbeschreibungcontent- WYSIWYG/Markdown - Vollständiger Projektinhaltmeta_description- String - SEO Meta-Descriptionkeywords- String - SEO Keywordsog_image- String - Open Graph Image URL
4. content_pages (Bereits vorhanden, erweitern)
Aktuell:
- Für statische Inhalte wie "home-about", "privacy-policy", etc.
Erweitern um:
key- Eindeutiger Identifierpage_type- String (home_section/legal/about/custom)status- draft/publishedtranslations- O2M zucontent_pages_translations
5. hobbies (NEU - für "When I'm Not Coding")
Felder:
id- UUIDkey- String (unique) - z.B. "self_hosting", "gaming"icon- String - Icon-Namesort- Integerstatus- Stringtranslations- O2M zuhobbies_translations
Translations:
id- UUIDhobbies_id- M2O zuhobbieslanguages_code- M2O zulanguagestitle- String - z.B. "Self-Hosting & DevOps"description- Text - Beschreibung des Hobbys
6. messages (Bereits vorhanden via Directus Native Translations)
Struktur:
- Collection:
messages - Felder:
key- String - z.B. "nav.home", "common.loading"translations- Native Directus Translationsvalue- String - Übersetzter Text
🔄 Datenfluss
Aktuell (Hybrid):
PostgreSQL (Projects, Analytics) ←→ Next.js ←→ Messages (JSON Files)
↓
Directus (Content Pages)
Nach Migration (Unified):
Directus (Projects, Tech Stack, Content, Messages, Hobbies)
↓
GraphQL API
↓
Next.js (mit Fallback Cache)
↓
PostgreSQL (nur für Analytics: PageViews, UserInteractions)
📊 Was bleibt in PostgreSQL?
Nur echte Analytics-Daten:
PageView- SeitenaufrufeUserInteraction- Likes, Shares, BookmarksContact- Kontaktformular-EinträgeActivityStatus- Live-Status (Coding, Gaming, Music)
Warum?
- Hohe Frequenz von Updates
- Komplexe Aggregations-Queries
- Privacy/GDPR (keine Content-vermischung)
🎨 Directus UI Benefits
Was du gewinnst:
- ✅ WYSIWYG Editor für Projekt-Content
- ✅ Media Library für Bilder/Screenshots
- ✅ Bulk Operations (mehrere Projekte gleichzeitig bearbeiten)
- ✅ Revision History (Änderungen nachverfolgen)
- ✅ Workflows (Draft → Review → Publish)
- ✅ Access Control (verschiedene User-Rollen)
- ✅ REST + GraphQL API automatisch generiert
- ✅ Real-time Updates via WebSockets
🚀 Migration Plan
Phase 1: Tech Stack
- Collections erstellen in Directus
- Daten aus
messages/en.json&messages/de.jsonmigrieren About.tsxauf Directus umstellen
Phase 2: Hobbies
- Collection erstellen
- Daten migrieren
About.tsxerweitern
Phase 3: Projects
- Collection mit allen Feldern erstellen
- Migration-Script: PostgreSQL → Directus
- API Routes anpassen (oder Directus direkt nutzen)
/manageDashboard optional behalten oder durch Directus ersetzen
Phase 4: Messages (Optional)
- Alle keys aus
messages/*.jsonnach Directus next-intlConfig anpassen für Directus-Loader- JSON-Files als Fallback behalten
💾 Migration Scripts
Ich erstelle dir:
scripts/migrate-to-directus.ts- Automatische Migrationscripts/sync-from-directus.ts- Backup zurück zu PostgreSQLlib/directus-extended.ts- Alle GraphQL Queries
⚡ Performance
Caching-Strategie:
// 1. Versuch: Directus laden
// 2. Fallback: Redis Cache (5min TTL)
// 3. Fallback: Static JSON Files
// 4. Fallback: Hardcoded Defaults
ISR (Incremental Static Regeneration):
- Projects: Revalidate alle 5 Minuten
- Tech Stack: Revalidate alle 1 Stunde
- Content Pages: On-Demand Revalidation via Webhook
🔐 Security
Directus Access:
- Public Read (via Token) für Frontend
- Admin Write (via Admin Panel)
- Role-based für verschiedene Content-Types
Was public bleibt:
- Published Projects
- Published Content Pages
- Tech Stack
- Messages
Was protected bleibt:
- Drafts
- Analytics
- Admin Settings
📝 Nächste Schritte
Sag mir einfach:
- "Erstell mir die Collections" → Ich generiere JSON zum Import in Directus
- "Bau die Migration" → Ich schreibe Scripts zum Daten übertragen
- "Update den Code" → Ich passe alle Components & APIs an