From 4fcc5b989f8716271abed260791759f2fb4dcb8c Mon Sep 17 00:00:00 2001 From: Joachim Hummel Date: Thu, 4 Dec 2025 11:18:44 +0000 Subject: [PATCH] Update README: Complete project structure documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Comprehensive project structure update reflecting current implementation: - Add all API routes: admin, auth (forgot/reset/register), export, geofences, mqtt, users - Add all admin panel pages: emails, geofences+events, mqtt, settings, setup, users - Add all app pages: export, forgot-password, map, register, reset-password, unauthorized - Document complete components structure: demo, map (MapView + GeofenceLayer), AuthProvider - List all 18 lib files: geofence system, MQTT system, email service, crypto, geo-utils, etc. - Add all 15 scripts: geofence tests, MQTT sync, SMTP test, time filter debug, schema tools - Include new directories: emails/, mosquitto/config+logs, instrumentation.ts - Add Docker setup: docker-compose.yml, Dockerfile - Update data/ description: database.sqlite now includes MQTT + Geofences πŸ€– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- README.md | 124 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 111 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index b74368f..f4f1bea 100644 --- a/README.md +++ b/README.md @@ -856,34 +856,132 @@ server { location-tracker-app/ β”œβ”€β”€ app/ β”‚ β”œβ”€β”€ api/ -β”‚ β”‚ β”œβ”€β”€ auth/[...nextauth]/ # NextAuth API -β”‚ β”‚ β”œβ”€β”€ devices/ # Device CRUD -β”‚ β”‚ β”œβ”€β”€ locations/ # Location API + Sync/Cleanup/Stats -β”‚ β”‚ └── system/status/ # System Status (Uptime, Memory) +β”‚ β”‚ β”œβ”€β”€ admin/ +β”‚ β”‚ β”‚ β”œβ”€β”€ emails/ +β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ preview/ # Email Template Preview +β”‚ β”‚ β”‚ β”‚ └── send-test/ # Test Email versenden +β”‚ β”‚ β”‚ └── settings/ +β”‚ β”‚ β”‚ └── smtp/ # SMTP Einstellungen + Test +β”‚ β”‚ β”œβ”€β”€ auth/ +β”‚ β”‚ β”‚ β”œβ”€β”€ [...nextauth]/ # NextAuth API +β”‚ β”‚ β”‚ β”œβ”€β”€ forgot-password/ # Passwort vergessen +β”‚ β”‚ β”‚ β”œβ”€β”€ register/ # User Registrierung +β”‚ β”‚ β”‚ └── reset-password/ # Passwort zurΓΌcksetzen +β”‚ β”‚ β”œβ”€β”€ devices/ +β”‚ β”‚ β”‚ β”œβ”€β”€ [id]/ # Device CRUD (einzelnes Device) +β”‚ β”‚ β”‚ β”œβ”€β”€ public/ # Γ–ffentliche Device-Liste +β”‚ β”‚ β”‚ └── route.ts # Device Liste + Create +β”‚ β”‚ β”œβ”€β”€ export/ +β”‚ β”‚ β”‚ └── csv/ # CSV Export von Locations +β”‚ β”‚ β”œβ”€β”€ geofences/ +β”‚ β”‚ β”‚ β”œβ”€β”€ [id]/ # Geofence CRUD (einzelner Geofence) +β”‚ β”‚ β”‚ β”œβ”€β”€ events/ # Geofence Events abfragen +β”‚ β”‚ β”‚ └── route.ts # Geofence Liste + Create +β”‚ β”‚ β”œβ”€β”€ locations/ +β”‚ β”‚ β”‚ β”œβ”€β”€ cleanup/ # Alte Locations lΓΆschen +β”‚ β”‚ β”‚ β”œβ”€β”€ ingest/ # Location Import (MQTT) +β”‚ β”‚ β”‚ β”œβ”€β”€ optimize/ # DB Optimization (VACUUM) +β”‚ β”‚ β”‚ β”œβ”€β”€ stats/ # DB Statistiken +β”‚ β”‚ β”‚ β”œβ”€β”€ test/ # Test-Location hinzufΓΌgen +β”‚ β”‚ β”‚ └── route.ts # Location Query API +β”‚ β”‚ β”œβ”€β”€ mqtt/ +β”‚ β”‚ β”‚ β”œβ”€β”€ acl/ +β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ [id]/ # ACL Rule CRUD +β”‚ β”‚ β”‚ β”‚ └── route.ts # ACL Rules Liste + Create +β”‚ β”‚ β”‚ β”œβ”€β”€ credentials/ +β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ [device_id]/ # MQTT Credentials CRUD +β”‚ β”‚ β”‚ β”‚ └── route.ts # Credentials Liste + Create +β”‚ β”‚ β”‚ β”œβ”€β”€ send-credentials/ # Credentials per Email versenden +β”‚ β”‚ β”‚ └── sync/ # Mosquitto Config Sync +β”‚ β”‚ β”œβ”€β”€ system/ +β”‚ β”‚ β”‚ └── status/ # System Status (Uptime, Memory) +β”‚ β”‚ └── users/ +β”‚ β”‚ β”œβ”€β”€ [id]/ # User CRUD (einzelner User) +β”‚ β”‚ └── route.ts # User Liste + Create β”‚ β”œβ”€β”€ admin/ β”‚ β”‚ β”œβ”€β”€ devices/ # Device Management +β”‚ β”‚ β”œβ”€β”€ emails/ # Email Template Management +β”‚ β”‚ β”œβ”€β”€ geofences/ +β”‚ β”‚ β”‚ β”œβ”€β”€ events/ # Geofence Event History +β”‚ β”‚ β”‚ └── page.tsx # Geofence Management +β”‚ β”‚ β”œβ”€β”€ mqtt/ # MQTT Provisioning +β”‚ β”‚ β”œβ”€β”€ settings/ # SMTP Settings (Super Admin) +β”‚ β”‚ β”œβ”€β”€ setup/ # Setup Guide +β”‚ β”‚ β”œβ”€β”€ users/ # User Management +β”‚ β”‚ β”œβ”€β”€ layout.tsx # Admin Layout + Navigation β”‚ β”‚ └── page.tsx # Dashboard +β”‚ β”œβ”€β”€ export/ # CSV Export Seite +β”‚ β”œβ”€β”€ forgot-password/ # Passwort vergessen Seite β”‚ β”œβ”€β”€ login/ # Login-Seite -β”‚ β”œβ”€β”€ page.tsx # Γ–ffentliche Karte +β”‚ β”œβ”€β”€ map/ # Karten-Seite (alternative Route) +β”‚ β”œβ”€β”€ register/ # Registrierungs-Seite +β”‚ β”œβ”€β”€ reset-password/ # Passwort zurΓΌcksetzen Seite +β”‚ β”œβ”€β”€ unauthorized/ # Unauthorized Access Seite +β”‚ β”œβ”€β”€ page.tsx # Γ–ffentliche Karte (Home) β”‚ └── layout.tsx # Root Layout β”œβ”€β”€ components/ -β”‚ └── map/ -β”‚ └── MapView.tsx # Leaflet Map Component +β”‚ β”œβ”€β”€ demo/ +β”‚ β”‚ └── DemoMap.tsx # Demo Map Component +β”‚ β”œβ”€β”€ map/ +β”‚ β”‚ β”œβ”€β”€ GeofenceLayer.tsx # Geofence Visualization Layer +β”‚ β”‚ └── MapView.tsx # Leaflet Map Component +β”‚ └── AuthProvider.tsx # Auth Context Provider β”œβ”€β”€ lib/ β”‚ β”œβ”€β”€ auth.ts # NextAuth Config -β”‚ └── db.ts # SQLite Database Layer +β”‚ β”œβ”€β”€ crypto-utils.ts # Encryption/Decryption Utils +β”‚ β”œβ”€β”€ db.ts # SQLite Database Layer (User/Devices) +β”‚ β”œβ”€β”€ demo-data.ts # Demo/Test Data Generator +β”‚ β”œβ”€β”€ devices.ts # Device Helper Functions +β”‚ β”œβ”€β”€ email-renderer.ts # React Email Renderer +β”‚ β”œβ”€β”€ email-service.ts # Email Service (Nodemailer) +β”‚ β”œβ”€β”€ geofence-db.ts # Geofence Database Layer +β”‚ β”œβ”€β”€ geofence-engine.ts # Geofence Detection Engine +β”‚ β”œβ”€β”€ geofence-notifications.ts # Geofence Notification Handler +β”‚ β”œβ”€β”€ geo-utils.ts # Geolocation Utils (Haversine) +β”‚ β”œβ”€β”€ mosquitto-sync.ts # Mosquitto Config File Sync +β”‚ β”œβ”€β”€ mqtt-db.ts # MQTT Database Layer +β”‚ β”œβ”€β”€ mqtt-subscriber.ts # MQTT Subscriber Service +β”‚ β”œβ”€β”€ password-reset-db.ts # Password Reset Token DB +β”‚ β”œβ”€β”€ settings-db.ts # Settings Database Layer +β”‚ β”œβ”€β”€ startup.ts # Application Startup Logic +β”‚ β”œβ”€β”€ types.ts # TypeScript Type Definitions +β”‚ └── types/ +β”‚ └── smtp.ts # SMTP Type Definitions β”œβ”€β”€ scripts/ +β”‚ β”œβ”€β”€ add-test-location.js # Test-Location hinzufΓΌgen +β”‚ β”œβ”€β”€ cleanup-old-locations.js # Alte Locations lΓΆschen β”‚ β”œβ”€β”€ init-database.js # Database.sqlite Setup +β”‚ β”œβ”€β”€ init-geofence-db.js # Geofence Tables Setup β”‚ β”œβ”€β”€ init-locations-db.js # Locations.sqlite Setup -β”‚ β”œβ”€β”€ reset-admin.js # Admin User Reset β”‚ β”œβ”€β”€ remove-duplicates.js # Duplikate bereinigen -β”‚ └── cleanup-old-locations.js # Alte Daten lΓΆschen +β”‚ β”œβ”€β”€ reset-admin.js # Admin User Reset +β”‚ β”œβ”€β”€ show-schema.js # DB Schema anzeigen +β”‚ β”œβ”€β”€ sync-mqtt-config.ts # MQTT Config manuell syncen +β”‚ β”œβ”€β”€ test-geofence.js # Geofence Detektion testen +β”‚ β”œβ”€β”€ test-geofence-email.js # Geofence Email testen +β”‚ β”œβ”€β”€ test-geofence-notification.js # Geofence Notification testen +β”‚ β”œβ”€β”€ test-mqtt-geofence.js # MQTT Geofence Integration testen +β”‚ β”œβ”€β”€ test-smtp.js # SMTP Connection testen +β”‚ └── test-time-filter.js # Zeitfilter debuggen β”œβ”€β”€ data/ -β”‚ β”œβ”€β”€ database.sqlite # User + Devices +β”‚ β”œβ”€β”€ database.sqlite # User + Devices + MQTT + Geofences β”‚ └── locations.sqlite # Location Tracking +β”œβ”€β”€ emails/ # React Email Templates +β”‚ └── geofence-alert.tsx # Geofence Alert Email Template +β”œβ”€β”€ mosquitto/ +β”‚ β”œβ”€β”€ config/ # Mosquitto Config Files +β”‚ β”‚ β”œβ”€β”€ mosquitto.conf # Broker Config +β”‚ β”‚ β”œβ”€β”€ password.txt # Password File (bcrypt hashes) +β”‚ β”‚ └── acl.txt # ACL Rules File +β”‚ └── logs/ # Mosquitto Log Files +β”œβ”€β”€ public/ # Static Assets β”œβ”€β”€ types/ -β”‚ └── location.ts # TypeScript Interfaces -└── middleware.ts # Route Protection +β”‚ └── (deprecated - moved to lib/types.ts) +β”œβ”€β”€ middleware.ts # Route Protection Middleware +β”œβ”€β”€ instrumentation.ts # Next.js Instrumentation Hook +β”œβ”€β”€ docker-compose.yml # Docker Compose Setup +β”œβ”€β”€ Dockerfile # App Docker Image +└── package.json # Dependencies + Scripts ``` ---