How sirithreddy175-boop/telangana-rytu-seva works
Purpose and runtime
A TypeScript React/Vite application for an agriculture-focused farmer portal: weather and groundwater information, crop disease help, market prices and marketplace access, schemes/eligibility, localized content, reporting, and administration. Server-capable application startup is centered on src/start.ts and src/server.ts; browser routing is defined by src/router.tsx and generated src/routeTree.gen.ts.
Route and page composition
TanStack-style file routes provide the application’s navigation boundary. src/routes/__root.tsx establishes shared layout; src/routes/index.tsx is the public landing page; src/routes/dashboard.tsx and its dashboard.* children define authenticated/portal-style views. Administrative access is isolated in src/routes/admin-login.tsx and src/routes/admin.tsx.
Farmer dashboard domains
The UI is composed as feature-oriented React components rather than a monolithic dashboard. Key information and decision-support domains include weather (src/components/WeatherCard.tsx, src/components/WeatherAlertBanner.tsx), water (src/components/Groundwater.tsx, src/components/LiveGroundwater.tsx), market data (src/components/Prices.tsx, src/components/Marketplace.tsx), and public programs (src/components/Schemes.tsx, src/components/EligibilityChecker.tsx). Dedicated routed screens expose market prices, news, schemes, and villages.
Conversational and advisory interactions
AI and voice/chat experiences are front-end components backed by server-facing function modules: src/components/AskAI.tsx, src/components/Chatbot.tsx, and src/lib/ai.functions.ts; conversation and voice operations are separated in src/lib/chat.functions.ts and src/lib/voice.functions.ts. This boundary keeps credentialed or remote AI calls out of presentation components.
Location, localization, and data presentation
Location is a cross-cutting input to farmer-facing content, represented by src/components/LocationSelector.tsx and src/lib/location.tsx. Language switching and translation state live in src/components/LanguageToggle.tsx and src/lib/i18n.tsx. Domain data adapters include src/lib/farm-data.ts, src/lib/weather.functions.ts, and src/lib/mandi.functions.ts, which feed display components such as heatmaps, news, and prices.
Supabase persistence and authorization
Supabase is the primary backend integration, with browser/server clients separated in src/integrations/supabase/client.ts and src/integrations/supabase/client.server.ts. Authentication propagation is handled by src/integrations/supabase/auth-attacher.ts and src/integrations/supabase/auth-middleware.ts. Database schema evolution is versioned under supabase/migrations/; generated integration types reside in src/integrations/supabase/types.ts.
Administration and operational flows
Admin-only resource operations are separated from public farmer workflows through src/components/admin/ResourceManager.tsx, src/lib/admin.functions.ts, and src/lib/use-admin.ts. User reporting is an independent submission flow via src/components/FloatingReportButton.tsx and src/components/ReportForm.tsx. Shared error/configuration boundaries are provided by src/lib/error-capture.ts, src/lib/error-page.ts, and src/lib/config.server.ts.
Main entry points: client.ts Supabase clients · dashboard.tsx Dashboard routes · WeatherCard.tsx Farmer information widgets · routeTree.gen.ts Generated route tree
Components 19
Application Runtime
- Server startup · Bootstraps the server-capable application.
src/start.ts - Application server
src/server.ts - Route registry · Connects generated file routes to the application.
src/router.tsx - Generated route tree
src/routeTree.gen.ts
Farmer Portal
- Shared and public routes · Root layout and public landing page.
src/routes/__root.tsx - Dashboard routes · Dashboard and dashboard child views.
src/routes/dashboard.tsx - Farmer information widgets · Weather, groundwater, prices, marketplace, schemes, and eligibility views.
src/components/WeatherCard.tsx - Location context · Cross-cutting location input for farmer content.
src/lib/location.tsx - Localization state
src/lib/i18n.tsx - Farm data adapters · Weather, mandi, and farm-data access for presentation.
src/lib/weather.functions.ts
Advisory Services
- AI and chat UI · Ask AI and chatbot presentation experiences.
src/components/AskAI.tsx - AI service functions · Keeps remote or credentialed AI operations outside UI components.
src/lib/ai.functions.ts - Conversation and voice functions
src/lib/chat.functions.ts
Backend Integration
- Supabase clients · Separate browser and server backend clients.
src/integrations/supabase/client.ts - Auth propagation · Attaches and propagates Supabase authentication.
src/integrations/supabase/auth-middleware.ts - Database schema migrations
Administration & Reporting
- Admin access routes · Separate login and administrative navigation boundary.
src/routes/admin.tsx - Admin resource operations · Resource management for authorized administrators.
src/lib/admin.functions.ts - User reporting flow · Floating report entry and report submission form.
src/components/FloatingReportButton.tsx
Connections 21
- Server startup → Application server: boots
- Application server → Route registry: serves
- Route registry → Generated route tree: uses
- Generated route tree → Shared and public routes: includes
- Generated route tree → Dashboard routes: includes
- Dashboard routes → Farmer information widgets: composes
- Farmer information widgets → Location context: uses location
- Farmer information widgets → Localization state: uses translations
- Farmer information widgets → Farm data adapters: loads data from
- AI and chat UI → AI service functions: requests AI
- AI and chat UI → Conversation and voice functions: uses chat and voice
- Dashboard routes → AI and chat UI: exposes
- Farm data adapters → Supabase clients: accesses backend
- AI service functions → Supabase clients: uses backend
- Auth propagation → Supabase clients: configures sessions
- Supabase clients → Database schema migrations: persists to
- Admin access routes → Auth propagation: requires
- Admin access routes → Admin resource operations: opens
- Admin resource operations → Supabase clients: manages resources through
- Dashboard routes → User reporting flow: offers
- User reporting flow → Supabase clients: submits through