Cleanvee is a comprehensive facility management platform combining AI-powered quality verification, real-time SLA monitoring, and mobile-first operations for professional cleaning services. This version incorporates significant improvements in authentication, state management, and data persistence, addressing critical feedback from the product team.
Cleanvee transforms facility management with:
- AI-Powered Quality Verification: Gemini 3.5 analyzes photos to verify cleaning standards
- Robust Real-Time Data Layer:
useFirestoreDatahook with real-time listeners, exponential backoff, and debounced updates to prevent memory leaks. - Enhanced State Management: Centralized
AppContextanduseReducerfor predictable state transitions, replacing fragmenteduseStatecalls. - Secure Authentication System:
useAuthhook with Firebase Auth integration, demo mode fallback, and role-based access control. Auth flash race conditions have been mitigated. - Persistent Settings:
SettingsContextnow uses a dual-layer persistence strategy (localStorage + Firestore) with timestamp-based conflict resolution and a demo mode guard to prevent unnecessary Firestore writes. - Dynamic Theme Management:
ThemeContextprovides full dark mode functionality, saving preferences to localStorage and respecting system preferences, with future plans for Firestore sync. - Role-Based Access Control: Sidebar navigation and UI elements are dynamically filtered based on user roles (Cleaner, Manager, Admin).
- Improved Navigation: Header building dropdown now syncs with global app state, and a mobile-responsive sidebar with a hamburger menu has been implemented.
- Offline-First Mobile: Flutter app with NFC scanning and offline sync (planned for future development).
- Privacy-First Design: PII filtering before AI processing, comprehensive audit logs
- Enterprise-Grade Infrastructure: Firebase Firestore, Cloud Functions, Cloud Storage
- Demo Mode: Works without Firebase β perfect for testing and development, with clear indicators and explicit role selection.
Works in demo mode without any Firebase configuration β the app automatically falls back to mock data when environment variables are not set. Demo mode now includes an explicit role selector for easier testing.
- Quick Start
- Architecture
- Features
- Project Structure
- Setup Instructions
- Development
- Deployment
- Security
- Contributing
- Node.js 18+ and npm 9+
- Firebase CLI (optional, for backend deployment)
- Flutter SDK 3.0+ (optional, for mobile app)
# Clone repository
git clone https://github.com/Ishwarpatra/Cleanvee.git
cd Cleanvee
# Install dependencies
npm install
# Start development server (demo mode)
npm run dev
# Visit http://localhost:5173
# Demo credentials: Use any email/password, select role from dropdown.cd mobile_app
flutter pub get
flutter run -d chrome # Web
flutter run -d android # Android
flutter run -d ios # iOSβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Cleanvee Platform β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββββββββββ ββββββββββββββββββββ β
β β Web App β β Mobile App β β
β β (React/TS) β β (Flutter) β β
β β - Dashboard β β - NFC Scanning β β
β β - Team Mgmt β β - Photo Capture β β
β β - Reports β β - Offline Sync β β
β ββββββββββ¬ββββββββββ ββββββββββ¬ββββββββββ β
β β β β
β ββββββββββββ¬ββββββββββββ β
β β REST/Firestore β
β ββββββββββββΌβββββββββββ β
β β Firebase Backend β β
β βββββββββββββββββββββββ€ β
β β β’ Firestore (DB) β β
β β β’ Cloud Functions β β
β β β’ Cloud Storage β β
β β β’ Auth β β
β ββββββββββββ¬βββββββββββ β
β β β
β ββββββββββββΌβββββββββββ β
β β External Services β β
β βββββββββββββββββββββββ€ β
β β β’ Gemini 3.5 (AI) β β
β β β’ SendGrid (Email) β β
β β β’ Twilio (SMS) β β
β βββββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Principle | Implementation |
|---|---|
| Single Responsibility | Each context manages one concern; types.ts is types-only |
| Open/Closed | New settings fields extend AppSettings type without modifying SettingsContext |
| Liskov Substitution | useFirestoreData returns same interface whether using live or mock data |
| Interface Segregation | Components receive only the props they need |
| Dependency Inversion | Components depend on context hooks, not Firebase SDK directly |
Firebase Firestore βββΊ useFirestoreData hook βββΊ AppContext βββΊ Components
β β
β (fallback to mock data
β if Firebase not configured)
β
Firebase Auth βββΊ useAuth hook βββΊ Permission helpers βββΊ UI visibility
| Feature | Description | Role |
|---|---|---|
| Real-Time Dashboard | Live checkpoint status, SLA metrics, team activity with optimized data fetching | All |
| Building Management | CRUD operations, SLA configuration, floor plans | Manager+ |
| Team Management | Add/edit staff, role assignment, performance tracking | Manager+ |
| AI Reports | Shift summaries, quality insights, anomaly detection | Manager+ |
| Settings | System configuration, notification preferences with robust persistence and conflict resolution | Manager+ |
| Offline Support | Works without internet, syncs when online | All |
| Responsive Layout | Optimized for desktop and mobile devices with a new mobile navigation menu | All |
| Feature | Description |
|---|---|
| NFC Scanning | Tap to verify checkpoint cleaning |
| Photo Capture | AI-verified photo submission |
| Offline Logs | Queue logs offline, auto-sync when online |
| Real-Time Sync | Bi-directional sync with cloud |
| Role-Based UI | Different interfaces for Cleaner/Manager/Admin |
| Service | Purpose |
|---|---|
| AI Quality Verification | Gemini analyzes photos for cleaning quality |
| SLA Monitoring | Cloud Functions check intervals, trigger alerts |
| Notification Engine | Email/SMS alerts for SLA breaches |
| Privacy Filter | Removes PII before AI processing |
| Audit Logging | Tracks all data access and modifications |
Cleanvee/
βββ App.tsx # Root component (routing, layout)
βββ types.ts # All TypeScript interfaces and enums
βββ constants.tsx # Mock data and building definitions
βββ components/
β βββ DashboardGrid.tsx # Room status grid view
β βββ FloorPlan.tsx # Interactive floor plan
β βββ Header.tsx # Top navigation bar
β βββ LogFeed.tsx # Real-time cleaning log feed
β βββ ReportModal.tsx # AI shift report modal
β βββ SettingsView.tsx # Persistent settings panel
β βββ Sidebar.tsx # Navigation sidebar (role-based)
β βββ StatsOverview.tsx # KPI stats cards
β βββ TeamView.tsx # Team management (CRUD)
β βββ BuildingsView.tsx # Building management (CRUD)
β βββ LoginScreen.tsx # Firebase Auth UI
β βββ modals/ # Modal components
β βββ ui/
β βββ ErrorBoundary.tsx # React error boundary
β βββ DemoModeBanner.tsx # Demo mode indicator
β βββ Modal.tsx # Base modal
β βββ NotificationDropdown.tsx
β βββ ProfileDropdown.tsx
βββ src/
β βββ contexts/
β β βββ AppContext.tsx # Global app state (useReducer)
β β βββ SettingsContext.tsx # Persistent settings
β β βββ ThemeContext.tsx # Dark/light mode
β βββ hooks/
β β βββ useFirestoreData.ts # Real-time data + mock fallback
β β βββ useAuth.ts # Authentication state + RBAC
β βββ test/
β βββ setup.ts # Test setup
β βββ types.test.ts # Type validation tests
βββ services/
β βββ geminiService.ts # Gemini AI integration
β βββ mcpServer.ts # MCP data privacy layer
β βββ privacy/ # PII filtering
βββ functions/
β βββ src/
β βββ index.ts # Cloud Functions entry
β βββ analytics.ts # BigQuery streaming
β βββ slaMonitor.ts # SLA watchdog
βββ firestore.rules # Security rules (role-based)
βββ firestore.indexes.json # Composite indexes
βββ firebase.emulator.config.json # Emulator configuration
βββ .github/
β βββ workflows/
β βββ ci-cd.yml # GitHub Actions CI/CD pipeline
βββ mobile_app/ # Flutter mobile application
β βββ lib/
β β βββ main.dart # App entry point
β β βββ screens/ # Flutter screens
β β βββ providers/ # State management
β β βββ models/ # Data models
β βββ pubspec.yaml # Flutter dependencies
βββ README.md # This file
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview# Install Firebase CLI
npm install -g firebase-tools
# Login to Firebase
firebase login
# Initialize Firebase project
firebase init
# Select features:
# β Firestore
# β Functions
# β Storage
# β Hosting
# β Emulators
# Deploy Firestore security rules
firebase deploy --only firestore:rules
# Start emulator for local development
firebase emulators:start --config firebase.emulator.config.jsonCreate .env.local:
# Firebase (optional β app works without this)
VITE_FIREBASE_PROJECT_ID=your-project-id
VITE_FIREBASE_API_KEY=your-api-key
VITE_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
VITE_FIREBASE_DATABASE_URL=https://your-project.firebaseio.com
VITE_FIREBASE_STORAGE_BUCKET=your-project.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=your-sender-id
VITE_FIREBASE_APP_ID=your-app-id
# Gemini AI (optional)
VITE_GEMINI_API_KEY=your-gemini-keycd mobile_app
# Install dependencies
flutter pub get
# Run on web
flutter run -d chrome
# Run on Android
flutter run -d android
# Run on iOS
flutter run -d ios# Build web app
npm run build
# Deploy to Firebase Hosting
firebase deploy --only hosting
# Deploy Cloud Functions
firebase deploy --only functions
# Deploy Firestore rules
firebase deploy --only firestore:rules# Unit tests
npm test
# E2E tests
npm run test:e2e
# Coverage report
npm run test:coverage
# Cloud Function tests
cd functions && npm test# Type checking
npm run typecheck
# Linting
npm run lint
# Format code
npm run format| Script | Purpose |
|---|---|
npm run dev |
Start dev server |
npm run build |
Build for production |
npm run preview |
Preview production build |
npm test |
Run unit tests |
npm run typecheck |
TypeScript type checking |
npm run lint |
Run ESLint |
npm run format |
Format code with Prettier |
The project includes automated CI/CD via .github/workflows/ci-cd.yml:
- Lint & Type Check: Runs on every PR
- Unit Tests: Validates functionality
- Security Scan: Snyk vulnerability scanning
- Auto Deploy: Deploys to Firebase on main branch merge
| Secret | Description |
|---|---|
VITE_FIREBASE_API_KEY |
Firebase web API key |
VITE_FIREBASE_PROJECT_ID |
Firebase project ID |
VITE_FIREBASE_AUTH_DOMAIN |
Firebase auth domain |
VITE_FIREBASE_STORAGE_BUCKET |
Firebase storage bucket |
VITE_FIREBASE_MESSAGING_SENDER_ID |
Firebase messaging sender ID |
VITE_FIREBASE_APP_ID |
Firebase app ID |
VITE_GEMINI_API_KEY |
Google Gemini API key |
FIREBASE_SERVICE_ACCOUNT |
Firebase service account JSON |
# Deploy to Firebase Hosting
firebase deploy --only hosting
# Deploy all services
firebase deploy
# View deployment logs
firebase functions:log- Firebase Auth with email/password
- Role-Based Access Control (RBAC) with improved demo mode role selection
- JWT tokens for API requests
- Session management with auto-logout
- PII Filtering before AI processing
- Firestore Security Rules for row-level access control
- Comprehensive Audit Logs for all data access and modifications
We welcome contributions! Please see our Contributing Guidelines for more details.
This project is licensed under the MIT License - see the LICENSE file for details.