Skip to content
rishanmenezesPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

EcoFinds

EcoFinds is a sustainable second-hand marketplace that connects eco-conscious buyers and sellers. Our mission is to reduce waste and carbon emissions by giving pre-loved items a second life. Every purchase on EcoFinds contributes to a more sustainable future.

🌱 Features

Core Functionality

  • User Authentication: Secure sign-up and login powered by Supabase Auth with email verification
  • Product Marketplace: Browse and discover a wide range of second-hand products across multiple categories
  • Product Listings: Create and manage your own product listings with image uploads
  • Shopping Cart: Add items to cart and manage your shopping experience
  • Purchase History: Track your purchases and their environmental impact
  • User Profiles: Personalize your profile and view your eco-impact statistics
  • Seller Reviews: Rate and review sellers to build a trusted community
  • COβ‚‚ Impact Tracking: See the environmental impact of your second-hand purchases

User Experience

  • Responsive Design: Seamless experience across desktop, tablet, and mobile devices
  • Real-time Updates: Live cart count and instant product updates
  • Search & Filter: Advanced search functionality with category filtering
  • Eco Badges: Earn eco-champion badges based on your seller ratings and sales
  • Beautiful UI: Modern, eco-themed design with smooth animations

πŸ›  Technologies Used

Frontend

  • React 18.3.1 - UI library with TypeScript support
  • TypeScript 5.8.3 - Type-safe JavaScript
  • Vite 5.4.19 - Fast build tool and dev server
  • Tailwind CSS 3.4.17 - Utility-first CSS framework
  • Shadcn UI - Beautiful, accessible component library built on Radix UI
  • Radix UI - Unstyled, accessible UI primitives
  • React Router DOM 6.30.1 - Client-side routing
  • React Hook Form 7.61.1 - Form management with validation
  • TanStack Query 5.83.0 - Data fetching and state management
  • Lucide React 0.462.0 - Beautiful icon library
  • Sonner 1.7.4 - Toast notifications

Backend & Database

  • Supabase - Backend-as-a-Service providing:
    • PostgreSQL database
    • Authentication system
    • File storage for product images
    • Real-time subscriptions
    • Row Level Security (RLS)

Development Tools

  • ESLint 9.32.0 - Code linting and formatting
  • PostCSS 8.5.6 - CSS processing
  • Autoprefixer 10.4.21 - CSS vendor prefixing
  • TypeScript ESLint 8.38.0 - TypeScript linting

πŸ“¦ Installation

Prerequisites

  • Node.js 18+
  • npm or bun package manager
  • A Supabase project (free tier works)

Step-by-Step Setup

  1. Clone the repository:

    git clone https://github.com/rishanmenezes/ecofinds.git
    cd EcoFinds
  2. Install dependencies:

    npm install
    # or
    bun install
  3. Set up Supabase:

    • Create a new project at supabase.com
    • Run the SQL migration from supabase/migrations/20250906060706_fdcb8fa7-ee32-4159-a3e3-3c84952e37f7.sql
    • Create a storage bucket named product-images with public access
    • Enable Row Level Security (RLS) policies as defined in the migration
  4. Configure environment variables:

    Create a .env file in the root directory:

    VITE_SUPABASE_URL="YOUR_SUPABASE_URL"
    VITE_SUPABASE_ANON_KEY="YOUR_SUPABASE_ANON_KEY"

    Get these credentials from your Supabase project settings β†’ API.

  5. Update Supabase client configuration:

    Edit src/integrations/supabase/client.ts with your credentials:

    const SUPABASE_URL = "YOUR_SUPABASE_URL";
    const SUPABASE_PUBLISHABLE_KEY = "YOUR_SUPABASE_ANON_KEY";
  6. Run the development server:

    npm run dev
    # or
    bun run dev

    The application will be accessible at http://localhost:8080

πŸš€ Available Scripts

  • npm run dev - Start development server
  • npm run build - Build for production
  • npm run build:dev - Build for development mode
  • npm run lint - Run ESLint
  • npm run preview - Preview production build

πŸ“ Project Structure

EcoFinds/
β”œβ”€β”€ public/                          # Static assets
β”‚   β”œβ”€β”€ favicon.ico
β”‚   β”œβ”€β”€ placeholder.svg
β”‚   └── robots.txt
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/                  # Reusable components
β”‚   β”‚   β”œβ”€β”€ Layout/
β”‚   β”‚   β”‚   └── Navbar.tsx          # Main navigation bar
β”‚   β”‚   β”œβ”€β”€ Product/
β”‚   β”‚   β”‚   └── ProductCard.tsx     # Product display card
β”‚   β”‚   └── ui/                     # Shadcn UI components (40+ components)
β”‚   β”‚       β”œβ”€β”€ button.tsx
β”‚   β”‚       β”œβ”€β”€ card.tsx
β”‚   β”‚       β”œβ”€β”€ input.tsx
β”‚   β”‚       └── ... (many more)
β”‚   β”œβ”€β”€ hooks/                      # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ useAuth.tsx             # Authentication state management
β”‚   β”‚   β”œβ”€β”€ use-mobile.tsx          # Mobile detection
β”‚   β”‚   └── use-toast.ts            # Toast notifications
β”‚   β”œβ”€β”€ integrations/               # Third-party integrations
β”‚   β”‚   └── supabase/
β”‚   β”‚       β”œβ”€β”€ client.ts           # Supabase client configuration
β”‚   β”‚       └── types.ts            # TypeScript type definitions
β”‚   β”œβ”€β”€ lib/                        # Utility functions
β”‚   β”‚   └── utils.ts                # Helper functions
β”‚   β”œβ”€β”€ pages/                      # Application pages
β”‚   β”‚   β”œβ”€β”€ Index.tsx               # Landing page
β”‚   β”‚   β”œβ”€β”€ Auth.tsx                # Login/Signup page
β”‚   β”‚   β”œβ”€β”€ Feed.tsx                # Product marketplace
β”‚   β”‚   β”œβ”€β”€ AddProduct.tsx          # Product listing form
β”‚   β”‚   β”œβ”€β”€ MyListings.tsx          # User's product management
β”‚   β”‚   β”œβ”€β”€ Cart.tsx                # Shopping cart
β”‚   β”‚   β”œβ”€β”€ Purchases.tsx           # Purchase history
β”‚   β”‚   β”œβ”€β”€ Profile.tsx             # User profile
β”‚   β”‚   └── NotFound.tsx            # 404 page
β”‚   β”œβ”€β”€ App.tsx                     # Main app component with routing
β”‚   β”œβ”€β”€ main.tsx                    # Application entry point
β”‚   β”œβ”€β”€ index.css                   # Global styles and Tailwind directives
β”‚   └── App.css                     # Additional app styles
β”œβ”€β”€ supabase/                       # Supabase configuration
β”‚   β”œβ”€β”€ config.toml                 # Supabase CLI config
β”‚   └── migrations/
β”‚       └── 20250906060706_*.sql    # Database schema migration
β”œβ”€β”€ .env                            # Environment variables (not in git)
β”œβ”€β”€ .gitignore                      # Git ignore rules
β”œβ”€β”€ components.json                 # Shadcn UI configuration
β”œβ”€β”€ eslint.config.js               # ESLint configuration
β”œβ”€β”€ package.json                    # Dependencies and scripts
β”œβ”€β”€ postcss.config.js              # PostCSS configuration
β”œβ”€β”€ tailwind.config.ts             # Tailwind CSS configuration
β”œβ”€β”€ tsconfig.json                  # TypeScript configuration
β”œβ”€β”€ tsconfig.app.json              # App TypeScript config
β”œβ”€β”€ tsconfig.node.json             # Node TypeScript config
β”œβ”€β”€ vite.config.ts                 # Vite build configuration
└── README.md                      # This file

πŸ—„ Database Schema

Tables

profiles

Extends Supabase auth.users with additional user information

  • id (UUID, Primary Key) - References auth.users
  • username (TEXT, Unique) - Display username
  • email (TEXT) - User email
  • created_at (TIMESTAMP) - Account creation date
  • updated_at (TIMESTAMP) - Last update date

products

Product listings in the marketplace

  • id (UUID, Primary Key) - Unique product identifier
  • title (TEXT) - Product title
  • description (TEXT) - Detailed product description
  • category (TEXT) - Product category
  • price (DECIMAL) - Product price
  • image_url (TEXT) - Product image URL
  • user_id (UUID, Foreign Key) - Seller's user ID
  • created_at (TIMESTAMP) - Listing creation date
  • updated_at (TIMESTAMP) - Last update date

cart

User shopping cart items

  • id (UUID, Primary Key) - Unique cart item identifier
  • user_id (UUID, Foreign Key) - Cart owner
  • product_id (UUID, Foreign Key) - Product reference
  • created_at (TIMESTAMP) - Addition date
  • Unique constraint on (user_id, product_id)

purchases

Purchase history records

  • id (UUID, Primary Key) - Unique purchase identifier
  • user_id (UUID, Foreign Key) - Buyer's user ID
  • product_id (UUID, Foreign Key) - Purchased product
  • purchased_at (TIMESTAMP) - Purchase date

reviews

Seller reviews and ratings

  • id (UUID, Primary Key) - Unique review identifier
  • buyer_id (UUID, Foreign Key) - Reviewer's user ID
  • seller_id (UUID, Foreign Key) - Seller being reviewed
  • product_id (UUID, Foreign Key) - Related product
  • rating (INTEGER) - Rating from 1-5
  • review_text (TEXT) - Optional review text
  • created_at (TIMESTAMP) - Review date
  • Unique constraint on (buyer_id, product_id)

Storage

product-images bucket

Stores product images with the following policies:

  • Public read access for all users
  • Authenticated users can upload
  • Users can manage their own images (organized by user_id)

Security

All tables have Row Level Security (RLS) enabled with policies ensuring:

  • Users can only access their own data (cart, purchases, profile)
  • Public read access for products and reviews
  • Users can only modify their own products and listings
  • Automatic profile creation on user signup via database trigger

🎨 Design System

Color Palette

The application uses an eco-friendly green theme:

  • Primary: Forest green (#2d5a3d)
  • Secondary: Sage green (#9acd8a)
  • Tertiary: Earthy olive (#8b9a6b)
  • Earth: Warm brown (#8b7355)
  • Forest: Deep green (#1a4d2e)

Custom Components

  • Shadows: Eco-themed soft shadows
  • Gradients: Eco and earth gradient combinations
  • Animations: Custom fade-in, scale-in, and bounce animations
  • Dark Mode: Full dark theme support with eco-friendly colors

πŸ”‘ Key Features Explained

Authentication Flow

  1. User signs up with email, password, and username
  2. Supabase Auth handles email verification
  3. Database trigger automatically creates profile record
  4. Auth state persists via localStorage
  5. Protected routes redirect unauthenticated users

Product Listing Process

  1. User fills product details (title, description, category, price)
  2. Image is uploaded to Supabase Storage
  3. Product record is created in database
  4. Image URL is stored with product
  5. Product appears in marketplace feed

Shopping Flow

  1. Users browse products with search and category filters
  2. Add products to cart (prevents adding own products)
  3. Cart shows total and COβ‚‚ savings estimate
  4. Checkout moves items to purchases table
  5. Cart is cleared and purchase history is updated

COβ‚‚ Impact Calculation

The application estimates environmental impact using a simple formula:

COβ‚‚ Savings = (Product Price Γ— 0.1) + Random Factor (0-2kg)

This is a simplified calculation for demonstration purposes.

πŸ‘₯ Contributors

  • Rishan Menezes - Project Lead
  • Rakesh G - Frontend Development
  • Nagaraju HL - Backend Integration
  • Prithvi HN - UI/UX Design

πŸŽ₯ Demo

Watch a demo of EcoFinds:

https://youtu.be/u-iIejnpoww?si=P4MFfKKwY8Rhqp

🀝 Contributing

We welcome contributions to EcoFinds! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Follow the existing code style and conventions
  • Use TypeScript for type safety
  • Write clean, readable code with comments
  • Test your changes thoroughly
  • Ensure responsive design for all components

Areas for Improvement

  • Implement real payment gateway integration
  • Add real-time chat between buyers and sellers
  • Implement advanced search with filters
  • Add product comparison feature
  • Create seller dashboard with analytics
  • Implement push notifications
  • Add more accurate COβ‚‚ impact calculations
  • Create mobile app (React Native)
  • Add internationalization (i18n)
  • Implement advanced reporting system

πŸ“„ License

This project is open source and available under the MIT License.

🌍 Environmental Impact

EcoFinds is more than just a marketplaceβ€”it's a movement towards sustainable consumption. By choosing second-hand items, our users help:

  • Reduce Landfill Waste: Give pre-loved items a new life
  • Lower Carbon Emissions: Reduce manufacturing demand
  • Save Natural Resources: Conserve water, energy, and raw materials
  • Build Community: Connect eco-conscious individuals

Together, we're making a difference, one purchase at a time! 🌱

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages