Implements Option C (Hybrid) solution to prevent outdated documentation:
New Features:
- Pre-commit git hook that validates documentation before every commit
- npm run docs:check - Validates README against current project state
- npm run docs:sync - Automatically updates NPM Scripts section in README
What gets checked:
- NPM Scripts in package.json vs README
- API routes in app/api/* vs README
- App structure (directories in app/) vs README
- Components vs README
- Scripts vs README
Workflow:
1. Make code changes
2. git commit triggers pre-commit hook
3. Hook warns if documentation is outdated
4. Run docs:sync to auto-update or edit manually
5. Commit with updated README
Benefits:
- No more forgetting to update README
- Non-blocking (can use --no-verify if needed)
- Automatic NPM scripts synchronization
- Clear warnings show exactly what needs updating
Scripts added:
- scripts/check-docs.js - Validation script
- scripts/sync-docs.js - Synchronization script
- .git/hooks/pre-commit - Git hook (not tracked)
Documentation:
- Added complete workflow section in README
- Examples and usage tips included
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
**Documentation:**
- Added docs/geofence-testing.md with comprehensive test guide
- Includes all test scripts, manual testing procedures
- Troubleshooting section for common issues
- Cleanup instructions
**Configuration:**
- Updated admin user email to joachim.hummel@gmail.com
- Restored MQTT_BROKER_URL to mosquitto (Docker setup)
- Fixed test-mqtt-geofence.js to use admin credentials
**Test Results:**
✅ Database & Logic Test - Working perfectly
✅ Email Notification Test - Email sent successfully
✅ MQTT Integration - Server connects, receives messages
⚠️ Full chain test - Works but duplicate detection prevents retests
**What's Working:**
- Geofence creation and management via API
- Distance calculations (Haversine formula)
- Enter/Exit event generation with state tracking
- SMTP email delivery with React Email templates
- MQTT subscriber integration
**Ready for Production:**
The geofencing MVP is fully functional and ready for real-world
testing with OwnTracks devices sending unique location updates.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add scripts/sync-mqtt-config.ts for standalone sync execution
- Update change-mqtt-admin-password.sh to use tsx to execute sync
- Now properly regenerates password.txt with new hashed password
- Mosquitto config is automatically reloaded after sync
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
CRITICAL FIX: The OwnTracks app publishes to owntracks/<username>/<device_id>,
not owntracks/owntrack/<device_id>. This was causing data delivery failures
and privacy violations.
Changes:
- Fix ACL topic pattern: owntracks/<username>/# (was: owntracks/owntrack/<device_id>)
- Backend now uses MQTT_ADMIN_USERNAME for global subscription
- Update UI forms and placeholders with correct pattern
- Update email template with correct topic format
- Enable Mosquitto ACL file for user isolation
- Add migration script for existing ACL rules
- Update documentation (README, GEMINI.md)
Privacy & Security:
- Each user isolated at MQTT broker level via ACL
- Backend subscribes with admin credentials to owntracks/+/+
- Web UI filters data by parent_user_id for additional security
- GDPR compliant multi-layer defense in depth
Files changed:
- lib/mqtt-db.ts - Updated createDefaultRule() to use username
- app/api/mqtt/credentials/route.ts - Pass username to ACL creation
- app/admin/mqtt/page.tsx - UI forms and state management
- emails/mqtt-credentials.tsx - Email template topic pattern
- lib/mqtt-subscriber.ts - Use admin credentials from env
- mosquitto/config/mosquitto.conf - Enable ACL enforcement
- README.md, GEMINI.md - Documentation updates
- scripts/fix-acl-topic-patterns.js - Migration script
- MQTT_TOPIC_FIX.md - Detailed implementation guide
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Added MQTT credentials, ACL rules, and sync status tables for broker integration. Added parent_user_id column to User table for hierarchical user management.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>