How imroniel/leafcheck-ai works
Leaf-Check-AI is a mobile plant-care product combining plant records, image-based diagnosis, sensor telemetry, and care guidance. Its principal flow is a mobile user managing plants and scans, with the app communicating with backend routes that persist records or invoke diagnosis providers; sensor firmware is a separate telemetry source. The README also describes AR overlays and analytics, but the sampled files do not establish their implementation or wiring, so those links are marked unverified. Edges reflect excerpts, SOURCE INDEX references, or README statements; unsampled modules are represented conservatively.
Main entry points: index.tsx Expo Mobile App · server.ts HTTP Server and Routing · scan.ts Scan Diagnosis · prisma-pg.ts PostgreSQL Data
Components 24
Mobile App
- Expo Mobile App
frontend/app/(tabs)/index.tsx - Mobile Authentication
frontend/context/auth.tsx - Session Coordinator
frontend/services/session.ts - Secure Token Storage
frontend/services/token-storage.native.ts - Local Setup State
frontend/services/local-state-storage.ts - Garden and Plant Care
frontend/app/(tabs)/garden.tsx - Plant Scan Flow
frontend/services/scan-flow.ts - Health and Care Dashboard
frontend/app/(tabs)/tasks.tsx - Camera and AR View
frontend/app/(tabs)/camera.tsx - Backend API Client
frontend/services/api.ts
Backend API
- HTTP Server and Routing
backend/src/server.ts - Authentication Routes
backend/src/routes/auth.ts - Session and Token Logic
backend/src/lib/auth.ts - Plant Records
backend/src/routes/plants.ts - Scan Diagnosis
backend/src/routes/scan.ts - AI Analysis
backend/src/routes/ai.ts - Sensor Telemetry
backend/src/routes/telemetry.ts - PostgreSQL Data
backend/src/lib/prisma-pg.ts - Telemetry Store
backend/src/lib/prisma.ts
Diagnosis Providers
- Gemini Diagnosis
backend/src/lib/gemini.ts - Plant Identification Providers
backend/src/lib/plantnet.ts - Plant Catalog Provider
backend/src/lib/perenual.ts
Sensor Hardware
- ESP32 Sensor Firmware
hardware/firmware/src/main.cpp
Other components
- Plant Care User
Connections 30
- Plant Care User → Expo Mobile App: manages plants
- Expo Mobile App → Mobile Authentication: authenticates
- Mobile Authentication → Session Coordinator: coordinates sessions
frontend/context/auth.tsx - Mobile Authentication → Backend API Client: binds session
frontend/context/auth.tsx - Mobile Authentication → Secure Token Storage: uses token storage
- Expo Mobile App → Garden and Plant Care: manages collection
- Expo Mobile App → Plant Scan Flow: starts scans
- Expo Mobile App → Health and Care Dashboard: reviews care
- Plant Care User → Camera and AR View: views plant overlays
- Expo Mobile App → Local Setup State: stores setup data
- Backend API Client → HTTP Server and Routing: sends API requests
- HTTP Server and Routing → Authentication Routes: routes requests
backend/src/server.ts - HTTP Server and Routing → Plant Records: routes requests
backend/src/server.ts - HTTP Server and Routing → Scan Diagnosis: routes requests
backend/src/server.ts - HTTP Server and Routing → AI Analysis: routes requests
backend/src/server.ts - HTTP Server and Routing → Sensor Telemetry: routes requests
backend/src/server.ts - Authentication Routes → Session and Token Logic: uses session logic
backend/src/routes/auth.ts - Authentication Routes → PostgreSQL Data: reads and writes
backend/src/routes/auth.ts - Session and Token Logic → PostgreSQL Data: persists sessions
backend/src/lib/auth.ts - Plant Records → PostgreSQL Data: persists plant records
backend/src/routes/plants.ts - Scan Diagnosis → PostgreSQL Data: uses database
backend/src/routes/scan.ts - Scan Diagnosis → Telemetry Store: uses database
backend/src/routes/scan.ts - Scan Diagnosis → Gemini Diagnosis: requests diagnosis
backend/src/routes/scan.ts - Scan Diagnosis → Plant Identification Providers: identifies species
backend/src/routes/scan.ts - Scan Diagnosis → Plant Catalog Provider: looks up plant data
backend/src/routes/scan.ts - AI Analysis → Gemini Diagnosis: requests analysis
backend/src/routes/ai.ts - Sensor Telemetry → PostgreSQL Data: uses database
backend/src/routes/telemetry.ts - Sensor Telemetry → Telemetry Store: uses database
backend/src/routes/telemetry.ts - ESP32 Sensor Firmware → Sensor Telemetry: sends sensor readings
- Expo Mobile App → Health and Care Dashboard: reviews analytics