Skip to content

alhasandhali/plateShare-server-site

Repository files navigation

PlateShare — Community-Driven Food Donation & Sharing Platform

Live Demo Server Repo Client Repo

PlateShare is a full-stack community platform designed to reduce food waste and help those in need. It allows food donors to list surplus meals, which hungry individuals or organizations can browse and request. This repository contains the Backend (Server-Side) code built with Node.js and Express.


🚀 Project Overview

The primary mission of PlateShare is to bridge the gap between food abundance and food scarcity. By providing a real-time, transparent platform, we empower community members to share resources efficiently and securely.

Core Features:

  • Dynamic Food Listings: Real-time visibility of available food items sorted by quantity and expiration.
  • Secure Authentication: JWT-based verification using Firebase Admin SDK for all sensitive operations.
  • Request Management: Seamless flow for requesting food and tracking the status of those requests.
  • User Profiles: Personalized dashboards for donors to manage their contributions.
  • Search & Filter: Advanced querying by food name, location, and status.

🛠️ Technology Stack

Backend (This Repository)

  • Runtime: Node.js
  • Framework: Express.js
  • Database: MongoDB Atlas
  • Authentication: Firebase Admin SDK
  • Deployment: Vercel

Frontend (Connected App)

  • Framework: React 19 (Vite)
  • Styling: Tailwind CSS v4, DaisyUI 5
  • Icons & Animations: Lucide React, Framer Motion
  • Data Fetching: TanStack Query (v5), Axios

📂 Project File Structure

Below is the complete file structure for both the Server and Client projects to give a full overview of the ecosystem.

Server-Side Structure (Current Repo)

plateShare-server-site/
├── .env                         # Environment variables (DB, Firebase)
├── index.js                     # Main server entry point (Express routes & logic)
├── package.json                 # Project dependencies and scripts
├── vercel.json                  # Deployment configuration for Vercel
├── encode.js                    # Utility to encode Firebase key to Base64
├── plateshare-firebase-admin-key.json # Raw Firebase Admin credentials (GIT IGNORED)
├── node_modules/                # Project dependencies
└── README.md                    # Detailed documentation

Client-Side Structure

plateShare-client-site/
├── public/                      # Static assets
├── src/
│   ├── components/              # Reusable UI components (Navbar, Footer, Modal, etc.)
│   ├── context/                 # AuthContext (Firebase auth bridge)
│   ├── hooks/                   # Custom hooks (useAxiosSecure, useAxiosPublic)
│   ├── pages/                   # Route-level components (Home, AvailableFoods, Dashboard)
│   ├── Route/                   # React Router 7 configuration
│   ├── App.jsx                  # Main application layout
│   └── main.jsx                 # Entry point
└── ...

📥 Installation & Local Setup

Follow these steps to get the full project running on your local machine.

1. Clone the Repositories

# Clone Server
git clone https://github.com/alhasandhali/plateShare-server-site.git
cd plateShare-server-site

# Clone Client (In a separate folder)
git clone https://github.com/alhasandhali/plateShare-client-site.git

2. Server Setup

  1. Install dependencies:
    npm install
  2. Configure Environment Variables: Create a .env file in the server root:
    PORT=3000
    DB_USER=your_mongodb_username
    DB_PASS=your_mongodb_password
    FIREBASE_SERVICE_KEY=your_base64_encoded_firebase_admin_key
  3. Start the server:
    node index.js
    # or using nodemon
    nodemon index.js

3. Client Setup

  1. Navigate to client folder:
    cd plateShare-client-site
    npm install
  2. Configure .env.local: Add your Firebase and ImgBB API keys.
  3. Run the app:
    npm run dev

🔌 API Documentation (Key Endpoints)

Food Operations

  • GET /foods - Get all foods (supports filters like donator_email, status).
  • GET /featured-foods - Get top 6 foods by quantity.
  • POST /food - Add a new food item (Protected).
  • PATCH /food/:id - Update food details or status (Protected).
  • DELETE /food/:id - Remove a food listing (Protected).

User Operations

  • POST /user - Register or update user in database.
  • GET /user/email/:email - Get user details by email.
  • GET /users - List all users (Admin only/Protected).

Request Operations

  • GET /requested-foods - Get food requests for a specific user (Protected).
  • POST /requested-food - Submit a new food request (Protected).
  • PATCH /requested-food/:id - Update request status (Accepted/Rejected).

🛡️ Data Models (MongoDB)

Food Listing Schema

{
  "food_name": "string",
  "food_image": "url",
  "food_quantity": "number",
  "pickup_location": "string",
  "expire_date": "date",
  "additional_notes": "string",
  "donator_name": "string",
  "donator_email": "string",
  "donator_image": "url",
  "food_status": "Available | Requested"
}

👤 Author

Al Hasan Dhali


"Don’t waste food — share it. Every plate shared brings hope to another."

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published