pramodbhat11

WasteToWealth - Connecting Farmers and Companies for Sustainable Waste Management

WasteToWealth is a web application that bridges the gap between farmers who produce agricultural waste and companies that can utilize this waste for various industrial purposes. This platform facilitates sustainable waste management by connecting waste producers with waste consumers.

๐ŸŒฑ Project Overview

This is a college-level Node.js web application built with Express.js that enables:

๐Ÿ› ๏ธ Tech Stack

Backend

Frontend

Authentication & Security

Additional Libraries

๐Ÿ“ Project Structure

wastetowealth/
โ”œโ”€โ”€ models/                 # Mongoose schemas
โ”‚   โ”œโ”€โ”€ FarmersListing.js    # Farmer waste listings
โ”‚   โ”œโ”€โ”€ CompanyListing.js    # Company requirements
โ”‚   โ”œโ”€โ”€ farmerlogin.js       # Farmer user model
โ”‚   โ””โ”€โ”€ companylogin.js      # Company user model
โ”œโ”€โ”€ routes/                 # Route handlers
โ”‚   โ”œโ”€โ”€ farmerRoutes.js      # Farmer-specific routes
โ”‚   โ””โ”€โ”€ companyRoutes.js     # Company-specific routes
โ”œโ”€โ”€ middleware/             # Custom middleware
โ”‚   โ”œโ”€โ”€ farmerauth.js        # Farmer authentication
โ”‚   โ”œโ”€โ”€ companyauth.js       # Company authentication
โ”‚   โ””โ”€โ”€ ...                  # Other middleware
โ”œโ”€โ”€ views/                  # EJS templates
โ”‚   โ”œโ”€โ”€ home.ejs             # Home page
โ”‚   โ”œโ”€โ”€ index.ejs            # Farmer listings view
โ”‚   โ”œโ”€โ”€ indexcompany.ejs     # Company listings view
โ”‚   โ””โ”€โ”€ ...                  # Other view templates
โ”œโ”€โ”€ public/                 # Static assets
โ”‚   โ”œโ”€โ”€ css/                 # Stylesheets
โ”‚   โ””โ”€โ”€ uploads/             # Uploaded images
โ”œโ”€โ”€ tests/                  # Selenium test suite
โ”‚   โ”œโ”€โ”€ selenium_tests.py    # Main test file
โ”‚   โ””โ”€โ”€ ...                  # Other test files
โ”œโ”€โ”€ app.js                  # Main application file
โ””โ”€โ”€ package.json            # Dependencies

๐Ÿš€ Getting Started

Prerequisites

Installation

  1. Clone the repository
    git clone <repository-url>
    cd wastetowealth
    
  2. Install dependencies
    npm install
    
  3. Start MongoDB Make sure MongoDB is running on your system:
    # On Windows
    net start MongoDB
       
    # On macOS/Linux
    mongod
    
  4. Start the application
    npm start
    

    Or for development with auto-restart:

    npx nodemon app.js
    
  5. Access the application Open your browser and navigate to:
    http://localhost:8080
    

๐Ÿ” User Roles

Farmers

Companies

๐Ÿ“‹ Core Features

1. User Authentication

2. Listing Management

3. Matching System

4. Search & Filter

๐Ÿงช Testing

The project includes comprehensive Selenium tests for end-to-end testing.

Setup Testing Environment

  1. Install Python dependencies
    cd tests
    pip install -r requirements.txt
    
  2. Run Tests
    # Run all tests
    python run_tests.py
       
    # Run specific test file
    python improved_selenium_tests.py
       
    # Run with unittest
    python -m unittest improved_selenium_tests.WasteToWealthTests -v
    

Test Coverage

โœ… Home page navigation โœ… Farmer registration and login โœ… Company registration and login โœ… Creating and managing listings โœ… Viewing and browsing listings โœ… Logout functionality โœ… Form validation โœ… Error handling

๐Ÿ—„๏ธ Database Schema

Farmer Listings

{
  farmerName: String,
  wastetype: String,
  quantity: Number,
  location: String,
  contactPhone: String,
  image: String,
  email: String,
  createdAt: Date
}

Company Listings

{
  companyName: String,
  wastetypeRequired: String,
  requiredQuantity: Number,
  location: String,
  contactEmail: String,
  contactPhone: String,
  description: String,
  createdAt: Date
}

๐ŸŽฏ Key Routes

Public Routes

Farmer Routes

Company Routes

๐Ÿค Contributing

This is a college project, but contributions are welcome!

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

๐Ÿ“ License

This project is licensed under the ISC License.

๐Ÿ‘จโ€๐Ÿ’ป Author

Pramod - College Student

๐Ÿ™ Acknowledgments


This project demonstrates full-stack web development skills with user authentication, database integration, and automated testing.