How quantamaster/roadguard works
Project Type and Purpose
• This is a full-stack AI-driven web & mobile PWA for road distress detection.
• Front-end: TypeScript + React + Vite (files like App.tsx, index.tsx, service-worker.ts, manifest.json).
• Backend (described in README, not in this repo): Python inference service using OpenCV and SAM, plus geo-tag storage.
Main Components
1. User Device (Web/Mobile Browser)
– React App (App.tsx, index.html, index.tsx)
– PWA Layer: service-worker.ts, manifest.json, metadata.json
– Static Assets & Config: vite.config.ts, constants.ts, types.ts
2. API Layer / Gateway
– HTTPS endpoints exposed by the Python backend or AI Studio App
– Authentication (e.g., GEMINI_API_KEY in .env.local)
3. Backend Inference Service
– Python ML Server (main.py, requirements.txt)
– Computer Vision (OpenCV)
– AI Models:
• Detection Stage (custom model)
• Segment Anything Model (SAM) for mask segmentation
– Post-Processing: mask overlay generation, geo-coordinate tagging
4. Data Storage
– Temporary in-memory or file store for masks
– Persistent store (e.g., database or GIS dashboard) for geo‐tagged results
5. External Services
– Gemini API or other LLM/AI APIs (if used)
– Mapping service or GIS dashboard integration
Architectural Patterns & Design Principles
• Three-Tier Architecture:
– Presentation (React PWA)
– Application/API Layer (REST or WebSocket)
– ML Inference & Data Layer
• PWA Best Practices: offline support (service-worker), manifest for installability
• Componentization: small React components (App.tsx, constants.ts, types.ts)
• Separation of Concerns: UI vs. AI logic vs. data persistence
Essential Details to Capture
• The React entrypoint (index.html → index.tsx → App.tsx)
• PWA capabilities (service-worker.ts, manifest.json)
• Vite build & configuration (vite.config.ts)
• ML pipeline stages (Detection → SAM → Post-Processing)
• Geo-tag and visualization feedback loop to front-end