Skip to content

Tejas164321/Left2Lift

Repository files navigation

🌿 Left2Lift

Connecting food donors and NGOs to reduce food waste and power last-mile food redistribution.

React TypeScript Vite Firebase TailwindCSS Google Maps React Router MIT License


πŸ“Œ Table of Contents


🌍 Overview

Left2Lift is a role-based web app built to eliminate food waste at the last mile.

Role Who What they do
🍽️ Donor Restaurants, events, caterers Post surplus food pickups with location & time details
🀝 NGO Non-profit organizations Discover nearby donations, claim them, and navigate to pickups

The platform provides real-time updates, map-based discovery, and route optimization β€” making food redistribution fast and transparent.


πŸ”„ How It Works

1. Donor signs in β†’ posts a new food donation
         ↓
2. Donation saved to Firestore  (status: available)
         ↓
3. NGO dashboard receives real-time update
         ↓
4. NGO claims a donation  (status: claimed)
         ↓
5. NGO navigates using in-app map route tools
         ↓
6. Pickup completed and marked done  (status: picked)

✨ Implemented Features

πŸ” Authentication & Roles

  • Email/password sign-up and login via Firebase Authentication
  • Role selection during signup: donor or ngo
  • Role-based routing:
    • /donor β†’ Donor dashboard
    • /ngo β†’ NGO dashboard

🍽️ Donor Features

  • Post a donation with:
    • Title, description, quantity, and food type
    • Best-before datetime and pickup window
    • Address + GPS coordinates
  • Google Places Autocomplete for address input
  • Browser geolocation auto-fill as fallback
  • Donor dashboard with live status summary cards:
    • Total Β· Available Β· Claimed Β· Completed

🀝 NGO Features

  • Real-time donation feed powered by Firestore listeners
  • Toggle between Map View and List View
  • Smart filters: All Available Β· Available Now Β· Claimed Β· Mine
  • One-click claim flow with instant Firestore status sync
  • Quick open route in Google Maps (maps/dir β†’ fallback to maps/search)
  • Live map markers with donation info windows
  • Multi-pickup route planner:
    • Optimized waypoints via Google Directions API
    • ETA + distance display
    • Step-by-step progress tracking and completion flow
  • In-app notifications when new donations are posted

🎨 UI / UX

  • Fully responsive dashboards for donor and NGO roles
  • Status-aware donation cards with color-coded badges
  • Modal-based posting and route flows
  • Clean design powered by Tailwind CSS + Lucide icons

πŸ› οΈ Tech Stack

Layer Technology
βš›οΈ Frontend React 18 + TypeScript
⚑ Build Tool Vite 5
πŸ”€ Routing React Router DOM 7
🎨 Styling Tailwind CSS
πŸ–ΌοΈ Icons Lucide React
πŸ” Authentication Firebase Authentication
πŸ—„οΈ Database Cloud Firestore (real-time)
πŸ“¦ Storage Firebase Storage
πŸ—ΊοΈ Maps Google Maps JS API β€” Maps Β· Places Β· Directions Β· Geometry

πŸ“‚ Project Structure

Left2Lift/
β”œβ”€β”€ public/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ Auth/               # Login, Signup, Role selection
β”‚   β”‚   β”œβ”€β”€ Donor/              # Donor dashboard & post-donation forms
β”‚   β”‚   β”œβ”€β”€ NGO/                # NGO feed, map view, route planner
β”‚   β”‚   └── Layout/             # Shared layout wrappers, navbar
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   └── firebase.ts         # Firebase app initialization
β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   β”œβ”€β”€ useAuth.ts          # Auth state & role management
β”‚   β”‚   └── useGoogleMaps.ts    # Maps API loader & helpers
β”‚   β”œβ”€β”€ types/
β”‚   β”‚   └── index.ts            # Shared TypeScript interfaces
β”‚   └── App.tsx                 # Root component & route definitions
β”œβ”€β”€ .env                        # Environment variables (not committed)
β”œβ”€β”€ .env.example                # Template for environment setup
β”œβ”€β”€ index.html
β”œβ”€β”€ package.json
β”œβ”€β”€ tailwind.config.ts
β”œβ”€β”€ tsconfig.json
└── vite.config.ts

πŸš€ Getting Started

Prerequisites

  • Node.js v18 or higher
  • npm v9+ (or yarn / pnpm)
  • A Firebase project β†’ Create one here
  • A Google Cloud project with Maps APIs enabled β†’ Cloud Console

1) Clone the repository

git clone https://github.com/Tejas164321/Left2Lift.git
cd Left2Lift

2) Install dependencies

npm install

3) Add environment variables

cp .env.example .env
# Open .env and fill in your Firebase + Google Maps keys

4) Start the development server

npm run dev

Open the local URL shown by Vite β€” typically http://localhost:5173


πŸ” Environment Variables

Create a .env file in the project root (same level as package.json):

# Firebase Configuration
VITE_FIREBASE_API_KEY=your_firebase_api_key
VITE_FIREBASE_AUTH_DOMAIN=your-project-id.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your-project-id
VITE_FIREBASE_STORAGE_BUCKET=your-project-id.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
VITE_FIREBASE_APP_ID=your_app_id
 
# Google Maps
VITE_GOOGLE_MAPS_API_KEY=your_google_maps_api_key

Where to find these values

Variable Where to get it
VITE_FIREBASE_* Firebase Console β†’ Project Settings β†’ Your Apps β†’ Web App SDK Config
VITE_GOOGLE_MAPS_API_KEY Google Cloud Console β†’ APIs & Services β†’ Credentials β†’ Create API Key

Required Google Maps APIs

Enable all of the following in your Google Cloud project:

  • βœ… Maps JavaScript API
  • βœ… Places API
  • βœ… Directions API
  • βœ… Geometry Library (loaded via Maps JS API)

πŸ’‘ Tip: Restrict your API key by HTTP referrer in production to prevent unauthorized usage.


πŸ“œ Available Scripts

npm run dev       # Start development server with hot reload
npm run build     # Production build β†’ outputs to dist/
npm run preview   # Preview the production build locally
npm run lint      # Run ESLint across the project

🧾 Data Model (Firestore)

users collection

Field Type Description
email string User's email address
displayName string Display name
role "donor" | "ngo" User role assigned at signup
createdAt timestamp Account creation time

donations collection

Field Type Description
donorId string UID of the posting donor
donorName string Display name of the donor
title string Donation title
description string Description of the food
quantity string Amount / portions available
foodType string Category (e.g. cooked, packaged)
expiryTime timestamp Best-before datetime
pickupWindow string Available pickup time range
location.lat number Latitude coordinate
location.lng number Longitude coordinate
location.address string Human-readable address
status "available" | "claimed" | "picked" | "expired" Current donation status
claimedBy string? NGO UID (set when claimed)
claimedByName string? NGO display name (set when claimed)
claimedAt timestamp? Timestamp of when donation was claimed
createdAt timestamp When the donation was originally posted

⚠️ Firestore Indexes: Combined where + orderBy queries used in dashboards may require composite indexes. Firestore will log a direct link in your browser console to create them if they are missing.


πŸ“ Notes

  • Some UI labels may still reference older naming (e.g. "ZeroWaste DineMap" text in a few places). These are cosmetic leftovers and do not affect any core functionality.
  • Configure Firestore Security Rules before deploying to production to restrict read/write access by user role.
  • The Google Maps API key should be HTTP referrer restricted in production environments.

🀝 Contributing

Contributions, issues, and feature requests are welcome!

  1. Fork the repository
  2. Create a feature branch β†’ git checkout -b feature/your-feature-name
  3. Commit your changes β†’ git commit -m 'feat: describe your change'
  4. Push to the branch β†’ git push origin feature/your-feature-name
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.


Made with ❀️ to reduce food waste, one pickup at a time. ⭐ Star this repo if you find it helpful!

About

Bridging surplus food with hungry communities 🍲 | A Next.js + Firebase platform connecting restaurants with NGOs to reduce food waste and fight hunger sustainably

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors