How vikrammadhyasta/agritech works
1. What this repository is
- This is a frontend-only React application for the AgriTech platform, built with Vite + TypeScript and styled with Tailwind/shadcn/ui.
- The repo also includes the delivery pipeline and Kubernetes deployment manifests, so the architecture spans UI, build, containerization, and GitOps deployment.
2. Primary runtime boundary
- The app boots from index.html → src/main.tsx → src/App.tsx.
- App.tsx is the top-level composition point for routing/layout; the rest of the app is organized as page-level views and reusable UI components.
3. Route/page structure
- src/pages contains the major route targets:
- Public pages: Index, About, Products, Contact
- Auth flow: src/pages/auth/AuthPage.tsx
- Error handling: NotFound
- Role-specific dashboards: CustomerDashboard, DistributorDashboard, FarmerDashboard, RetailerDashboard
- This suggests a client-side routed SPA with public marketing pages plus authenticated role-based sections.
4. Layout and reusable presentation layer
- src/components/layout contains global frame elements like Navbar and Footer.
- src/components/home groups the landing-page sections (HeroSection, FeaturedProducts, StatsSection, AboutSection, ContactSection), which are composed into the home page.
- src/components/dashboard/DashboardLayout.tsx is the shared shell for dashboard pages, separating dashboard navigation/chrome from dashboard content.
5. Design system and UI primitives
- src/components/ui is a large shadcn-style component library: dialogs, forms, tables, tabs, tooltips, sidebars, toasts, etc.
- These are not business-specific; they provide the application’s consistent interaction primitives across public pages, auth, and dashboards.
6. State, responsiveness, and shared utilities
- src/hooks/use-mobile.tsx and src/hooks/use-toast.ts provide cross-cutting client behavior for responsive UI and notifications.
- src/lib/utils.ts likely centralizes common class/utility helpers used throughout the component tree.
- src/components/NavLink.tsx is a small navigation abstraction, probably used to keep navbar/sidebar links consistent.
7. Backend/data integration boundary
- The only explicit backend integration in the repo is Supabase under src/integrations/supabase.
- client.ts is the browser-side Supabase client; types.ts provides generated type safety for database records.
- supabase/migrations/...sql shows the database schema is managed separately from the frontend, so the frontend talks to a managed backend/data layer rather than a custom API server in this repo.
8. Data flow at application level
- User visits the static frontend, navigates through public content, and authenticates via the auth page.
- Role-specific dashboards then consume data from Supabase-backed services/database.
- The README describes domain actions like farmers listing produce, distributors verifying quality, retailers selling products, and customers placing orders; these are presentation/data flows rather than local business logic services inside this repo.
9. Styling and asset pipeline
- tailwind.config.ts, postcss.config.js, src/index.css, and src/App.css define the styling pipeline.
- components.json indicates component generation/configuration typical of shadcn/ui.
- The app is built as a static frontend bundle, with public/robots.txt and public holding static assets.
10. Containerization and local/runtime packaging
- Dockerfile packages the built frontend into a container image.
- There is no app server code in the tree, so the container likely serves static files generated by the Vite build.
- This is the artifact that gets pushed to the registry and deployed to Kubernetes.
11. CI/CD control plane
- Jenkinsfile defines the automated pipeline: source change → build → image creation → push to registry.
- The README describes AWS ECR as the private registry, making Jenkins the build-and-publish boundary between source control and deployment.
12. Deployment target and GitOps flow
- k8s/deployment.yaml, service.yaml, and application.yaml define the Kubernetes-side deployment.
- The README says ArgoCD watches GitHub and syncs Kubernetes manifests, so deployment is GitOps-driven rather than manually applied.
- Kubernetes is the runtime scheduler/exposure layer; the Service exposes the app, and the Deployment pulls the image from ECR.
13. Registry and secret handling
- The deployment uses an image pull secret for private ECR access, which is a critical infrastructure boundary.
- This means cluster access to images is intentionally separated from build access, and the manifest set must include imagePullSecrets support.
14. Architecture summary for a diagram
- Draw the app as a static React SPA with:
- user-facing pages and dashboards in the frontend
- Supabase as the managed data/auth backend
- Jenkins building Docker images
- AWS ECR storing images
- Kubernetes running the containerized frontend
- ArgoCD continuously syncing manifests from GitHub
- The key boundaries are UI vs. data/backend, build vs. runtime, and source control vs. cluster deployment.
Main entry points: App.tsx App · Index.tsx Home · DashboardLayout.tsx Dash Layout · button.tsx UI Library
Components 26
Frontend SPA
React application entry points, pages, layouts, and shared UI
- Index HTML · Static document that boots the Vite app
index.html - Main · Client entry that mounts the app
src/main.tsx - App · Top-level composition and routing boundary
src/App.tsx - Home · Public landing page
src/pages/Index.tsx - Products · Public product browsing page
src/pages/Products.tsx - About · Public about page
src/pages/About.tsx - Contact · Public contact page
src/pages/Contact.tsx - Auth · Authentication flow entry
src/pages/auth/AuthPage.tsx - Customer · Customer role dashboard
src/pages/dashboard/CustomerDashboard.tsx - Distributor · Distributor role dashboard
src/pages/dashboard/DistributorDashboard.tsx - Farmer · Farmer role dashboard
src/pages/dashboard/FarmerDashboard.tsx - Retailer · Retailer role dashboard
src/pages/dashboard/RetailerDashboard.tsx - Navbar · Primary site navigation
src/components/layout/Navbar.tsx - Footer · Primary site footer
src/components/layout/Footer.tsx - Dash Layout · Shared dashboard frame and navigation
src/components/dashboard/DashboardLayout.tsx - Home Sections · Hero, featured products, stats, about, and contact sections
src/components/home/HeroSection.tsx - Nav Link · Shared link abstraction for menus
src/components/NavLink.tsx
UI System
Reusable shadcn-style components and cross-cutting UI helpers
- UI Library · Reusable shadcn-style component set
src/components/ui/button.tsx - Hooks + Utils · Responsive and notification hooks plus class utilities
src/hooks/use-mobile.tsx
Backend Integration
Supabase client and generated database types
- Supabase Client · Browser client for Supabase services
src/integrations/supabase/client.ts - DB Types · Typed database schema bindings
src/integrations/supabase/types.ts
Delivery Pipeline
Build, container, CI/CD, and Kubernetes deployment
- Dockerfile · Packages the built frontend into an image
Dockerfile - Jenkinsfile · Build and publish automation
Jenkinsfile - Deployment · Kubernetes workload definition
k8s/deployment.yaml - Service · Kubernetes service exposure
k8s/service.yaml - ArgoCD App · GitOps application sync definition
k8s/application.yaml
Connections 33
- Index HTML → Main: boots · Browser loads the app entrypoint
- Main → App: mounts · React mounts the root app
- App → Home: routes to · Client-side routing reaches public home
- App → Products: routes to · Routes to product catalog
- App → About: routes to · Routes to about page
- App → Contact: routes to · Routes to contact page
- App → Auth: routes to · Routes to authentication flow
- App → Customer: routes to · Routes to customer dashboard
- App → Distributor: routes to · Routes to distributor dashboard
- App → Farmer: routes to · Routes to farmer dashboard
- App → Retailer: routes to · Routes to retailer dashboard
- Home → Navbar: uses · Public pages share the main navigation
- Home → Footer: uses · Public pages share the footer
- Home → Home Sections: composes · Landing page is assembled from home sections
- Customer → Dash Layout: uses · Role dashboards share the dashboard shell
- Distributor → Dash Layout: uses · Role dashboards share the dashboard shell
- Farmer → Dash Layout: uses · Role dashboards share the dashboard shell
- Retailer → Dash Layout: uses · Role dashboards share the dashboard shell
- Navbar → Nav Link: uses · Navigation is built from shared link abstraction
- Dash Layout → Nav Link: uses · Dashboard shell reuses navigation links
- Home → UI Library: renders with · Pages and sections rely on shared primitives
- Auth → UI Library: renders with · Auth flow uses shared form and dialog primitives
- Customer → UI Library: renders with · Dashboards use shared UI primitives
- Home → Hooks + Utils: uses · Shared responsive and toast behavior
- Auth → Hooks + Utils: uses · Authentication UI uses cross-cutting helpers
- UI Library → Hooks + Utils: depends on · UI primitives rely on shared helper utilities
- App → Supabase Client: reads/writes · App-level flows connect to Supabase services
- Supabase Client → DB Types: typed by · Client uses generated database types
- Jenkinsfile → Dockerfile: builds · CI pipeline produces the container image
- Dockerfile → Deployment: deploys as · Built image is consumed by Kubernetes deployment
- Deployment → Service: exposed by · Service fronts the deployment
- ArgoCD App → Deployment: syncs · ArgoCD syncs workload manifests
- ArgoCD App → Service: syncs · ArgoCD syncs service manifests