feat: Add guest mode authentication and fix dashboard telemetry display#11
Merged
Merged
Conversation
Major Features: - Add guest mode authentication with 30-minute tokens - Implement guest prediction endpoints (crop, fertilizer, suitability) - Fix dashboard real-time telemetry to display actual sensor data - Add offline support with request queuing for mobile app Backend Changes: - Add /api/v1/auth/guest endpoint for guest token generation - Create RequireUser() middleware to block guest access to user-only routes - Add guest-specific prediction endpoints: /api/v1/guest/predict/* - Fix ONNX inference to handle int64 output tensors - Update fertilizer labels to match actual model outputs Mobile App Changes: - Add guest mode UI flow with landing page integration - Implement guest authentication in authStore with isGuest flag - Add guest API methods (guestPredictCrop, guestPredictFertilizer, etc.) - Fix dashboard to normalize API response field names (n/p/k -> N/P/K) - Add detailed console logging for debugging sensor data flow - Fix StatCard value rendering to handle zero values correctly - Add guest badge indicator in predict page - Restrict guest access to predict/output pages only - Hide bottom navigation for guest users ML Model Fixes: - Re-export ONNX models with int64 outputs (ArgMax + Identity nodes) - Fix crop model: 23 classes with correct output tensor names - Fix fertilizer model: 7 classes with updated labels - Add model validation and conversion scripts Documentation: - Update README.md with new architecture and features - Document guest mode functionality - Add comprehensive API endpoint documentation - Update tech stack and project structure Bug Fixes: - Fix dashboard telemetry showing '--' instead of actual values - Fix 'Choose from History' button not displaying results - Fix 'Predict Again' button to clear results properly - Handle nested API response structure from backend - Fix race condition in guest login flow Testing: - All mobile tests pass - Backend endpoints tested and verified - Guest mode fully functional end-to-end Signed-off-by: Gagan Ahlawat <gagan.devvv@gmail.com>
- Remove stitch design files from repository - Keep stitch/ in .gitignore to prevent future commits - Files remain available locally for reference
- Add non-null assertions for accessToken in API calls - Remove email property from profile.tsx (not in AuthState) - Fix CI/CD typecheck failures Changes: - predict.tsx: Add ! operator for accessToken in guest mode checks - output.tsx: Add ! operator for accessToken in prediction calls - dashboard.tsx: Add ! operator for accessToken after guard check - profile.tsx: Remove email references (not stored in backend)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Overview
This PR introduces guest mode functionality for anonymous users and fixes critical dashboard telemetry issues. Users can now try predictions without registration, and the dashboard correctly displays real-time sensor data.
✨ Features
Guest Mode Authentication
Dashboard Telemetry Fix
🔧 Technical Changes
Backend (Go)
/api/v1/auth/guestendpoint for guest token generationRequireUser()middleware to block guest access to protected routes/api/v1/guest/predict/{crop,fertilizer,suitability}Mobile App (React Native)
isGuestflag in authStoreguestPredictCrop,guestPredictFertilizer, etc.)ML Models
🐛 Bug Fixes
--instead of actual sensor values📚 Documentation
🧪 Testing
📸 Screenshots
Before
--for all telemetry valuesAfter
🔄 Migration Notes
No breaking changes. Existing users are unaffected. Guest tokens are separate from user tokens.
📝 Checklist
Files Changed: 28 files (+2511, -623)
Commit: 6c76926