How soumyagarg30/eco-plate-predict-17 works
Project type and purpose
• This is a single-page, role-based full-stack web application built in React/TypeScript using Vite, Tailwind CSS, and shadcn-ui.
• It connects restaurants, NGOs, packers, and end-users to manage food waste, donation requests, packaging & pick-up workflows.
• The “backend” is a Supabase BaaS (Auth, PostgreSQL, Storage, Functions) accessed directly from the frontend.
File structure
• Top level: public/ (static assets), src/ (React code), supabase/ (configuration & migrations).
• In src/:
• pages/ holds route components (Index, Dashboards, Register, Prediction pages).
• components/ holds reusable UI (shadcn-ui primitives) + domain components (login, ngo, packing, packaging, restaurant, user).
• integrations/supabase/ contains the client wrapper and types.
• hooks/ & lib/ contain utility functions.
• Configs: vite.config.ts, tailwind.config.ts, tsconfig*.json.
README
• Confirms stack: Vite, TypeScript, React, shadcn-ui, Tailwind CSS.
• Mentions hosting/deploy via Lovable and custom domain options; no separate server code—uses Supabase.
Main components
a. Frontend SPA (browser)
• Vite-built React app
• Pages & UI Components
• Custom Hooks & Utils
b. API Layer / Integration
• Supabase client in src/integrations/supabase
c. BaaS Backend (Supabase)
• Auth service
• PostgreSQL database (+ migrations)
• Storage (file uploads)
• Edge functions (if any)
d. External services
• CDN / Static hosting (Lovable)
• Custom domain (optional)
Relationships & data flows
• User (browser) → HTTP(S) GET to CDN / static assets → SPA boots
• SPA → Supabase Auth (sign-in, sign-up)
• SPA → Supabase REST / Realtime for CRUD on users, restaurants, NGOs, orders, predictions
• SPA → Supabase Storage for upload/download of “lovable-uploads”
• (Optional) Domain DNS → CDN → SPA
Architectural patterns & design principles
• Component-based UI (shadcn-ui + domain components)
• Separation of concerns:
• Presentation (components/)
• Routing & pages (pages/)
• Data layer (integrations/supabase, utils/dbUtils.ts)
• BaaS pattern: no custom server—direct client↔Supabase
• Type safety with TypeScript
Essential elements to capture
• Static hosting (Lovable/CDN) serving index.html & assets
• SPA entry point (src/main.tsx → App.tsx)
• Route pages under different user roles
• Supabase services (Auth, DB, Storage) and migration file path
• Integration layer (src/integrations/supabase/client.ts)