PlantGuard AI Documentation
PlantGuard AI is an offline-first plant health journal and diagnostic companion. It combines client-side progressive web app (PWA) resilience with a high-performance Express backend powered by Google’s Gemini Vision AI and MongoDB.
Documentation Index
- Architecture Overview - High-level monorepo design, data flow, client-server separation.
- API Reference - Complete REST API specification (
/api/v1/*), request/response schemas, error formats.
- Authentication & Authorization - Argon2id password hashing, JWT access/refresh token rotation, session management, multi-tenant owner scoping.
- Database & Mongoose - MongoDB schema models, indexes, migrations, and seed scripts.
- AI Vision Model & Inference - Google Gemini Vision integration, prompt engineering, structured validation, rate limits, error fallbacks.
- Offline & Delta Sync - Local-first IndexedDB (Dexie) storage, outbox change tracking, bidirectional delta synchronization.
- Maps & Privacy - Nature Explorer OpenStreetMap/Leaflet integration, location obfuscation, privacy controls.
- Security & Production Hardening - Helmet, CORS policies, rate limiters, input sanitization, zero-secret logging with Pino.
- Deployment Guide - Docker, Node.js production service, reverse proxies, environment variables.
- Testing & Verification - Unit tests, integration tests, E2E verification, database connectivity tests.
- Migration Guide - Step-by-step migration from on-device SmolVLM to Gemini cloud backend and monorepo structure.
Quick Start
# Install dependencies across all workspaces
npm install
# Start both frontend and backend concurrently
npm run dev
# Run comprehensive checks across both workspaces
npm run check