How kds2383/earth-bloom-precision-agri works
Purpose and Runtime
Earth Bloom is a Vite/React TypeScript single-page precision-agriculture client. It presents crop, soil, weather, recommendation, results, account, and contact experiences. The checked-in repository is frontend-focused; the README describes Node/Express, MongoDB, and Python ML services, but their source is not present. Primary browser entry points are src/main.tsx and src/App.tsx.
Application Composition and Navigation
src/App.tsx is the application shell/router composition point, mapping page-level views under src/pages/. src/components/layout/Layout.tsx, src/components/layout/Navbar.tsx, and src/components/layout/Footer.tsx provide the shared navigational frame. The landing route is composed from feature-oriented marketing sections in src/pages/Index.tsx, src/components/home/HeroSection.tsx, and src/components/home/FeaturesSection.tsx.
Identity and Access Boundary
Authentication state is centralized in src/context/AuthContext.tsx. Firebase initialization is isolated in src/firebase.tsx, making Firebase the implemented identity boundary. src/components/auth/ProtectedRoute.tsx gates authenticated routes, while src/pages/Auth/SignIn.tsx and src/pages/Auth/SignUp.tsx are the user onboarding entry points.
Farmer Profile and Persisted User Data
The account workflow is centered at src/pages/Account.tsx and assembled through src/components/account/AccountForm.tsx. It captures profile, farm, location, and preferences through src/components/account/ProfileSection.tsx, src/components/account/FarmSection.tsx, and src/components/account/PreferencesSection.tsx. User-facing Firebase persistence is encapsulated by src/services/firebase/userService.ts, keeping page components separated from data-store calls.
Environmental Data Acquisition and State
Location entry is a reusable input boundary in src/components/location/LocationInput.tsx. Weather API access is isolated in src/utils/weatherApi.ts and configured through src/utils/envVars.ts; the weather experience is exposed by src/pages/Weather.tsx. Soil data has dedicated client state in src/store/soilDataStore.ts, consumed by src/pages/SoilData.tsx; this is the likely integration point for the README’s SoilGrids-style environmental source.
Recommendation and Results Flow
The domain flow runs from farmer/location and environmental inputs toward advice and presented outcomes. src/pages/Recommendation.tsx is the recommendation-facing stage; src/hooks/useResultsData.tsx provides a results-data abstraction consumed by src/pages/Results.tsx. src/utils/reportGenerator.ts forms the export/reporting boundary for generated agricultural results. ML prediction, backend orchestration, and MongoDB storage are external/claimed capabilities rather than implementation present in this tree.
UI System and Client Infrastructure
The app uses Tailwind styling and a local reusable component system under src/components/ui/, with application-wide styles in src/index.css and src/App.css. Vite supplies the browser build/development runtime (vite.config.ts), and environment values are expected from .env. Contact submission behavior is separated from its page in src/pages/Contact.tsx and src/utils/contactFormUtils.ts.
Main entry points: App.tsx App router shell · Recommendation.tsx Recommendation stage · ProtectedRoute.tsx Protected routes · Account.tsx Account workflow
Components 22
Browser Runtime
- Vite runtime
vite.config.ts - Browser entry
src/main.tsx
Application Experience
- App router shell
src/App.tsx - Shared layout · Navbar and footer surround routed views.
src/components/layout/Layout.tsx - Landing experience · Composes hero and feature sections.
src/pages/Index.tsx - Sign-in and sign-up
src/pages/Auth/SignIn.tsx - Protected routes
src/components/auth/ProtectedRoute.tsx - Account workflow · Uses the account form for profile, farm, location, and preferences.
src/pages/Account.tsx - Weather experience
src/pages/Weather.tsx - Soil data experience
src/pages/SoilData.tsx - Recommendation stage
src/pages/Recommendation.tsx - Results experience
src/pages/Results.tsx - Contact submission
src/pages/Contact.tsx
Client Data Boundaries
- Auth state
src/context/AuthContext.tsx - User persistence
src/services/firebase/userService.ts - Location input
src/components/location/LocationInput.tsx - Weather API client · Reads environment-configured weather access.
src/utils/weatherApi.ts - Soil data state
src/store/soilDataStore.ts - Results data abstraction
src/hooks/useResultsData.tsx - Report export
src/utils/reportGenerator.ts
External Services
Implemented and claimed service boundaries.
- Firebase identity
src/firebase.tsx - Claimed ML/backend · README-described prediction, orchestration, and MongoDB services have no checked-in source.
Connections 27
- Vite runtime → Browser entry: serves
- Browser entry → App router shell: mounts
- App router shell → Shared layout: uses
- App router shell → Landing experience: routes to
- App router shell → Sign-in and sign-up: routes to
- App router shell → Protected routes: guards
- Protected routes → Account workflow: allows
- App router shell → Weather experience: routes to
- App router shell → Soil data experience: routes to
- App router shell → Recommendation stage: routes to
- App router shell → Results experience: routes to
- App router shell → Contact submission: routes to
- Sign-in and sign-up → Auth state: authenticates through
- Protected routes → Auth state: checks
- Auth state → Firebase identity: uses
- Account workflow → User persistence: persists profile
- User persistence → Firebase identity: stores through
- Account workflow → Location input: collects location
- Weather experience → Location input: accepts location
- Weather experience → Weather API client: fetches weather
- Soil data experience → Soil data state: consumes
- Recommendation stage → Location input: uses location
- Recommendation stage → Soil data state: uses soil data
- Recommendation stage → Weather API client: uses weather
- Recommendation stage → Claimed ML/backend: future integration
- Results experience → Results data abstraction: consumes
- Results experience → Report export: exports