Skip to content

RCOM363/feed-forward

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FeedForward

FeedForward is a food donation platform built using the MERN stack, designed to bridge the gap between surplus food and those in need. The platform enables donors to share excess food, recipients to request food. QR codes and email notifications streamline the food distribution process.

Built With

React React Router React Hook Form Zod Tailwind Axios React Node.JS Express MongoDB Redis Mongoose JWT Cloudinary

Deployed with

s3 nginx ec2 docker

Demo Credentials:

City Admin

username: cityadmin-demo
password: cityadmin123

Donor

username: donor-demo
password: donor123

Recipient

username: recipient-demo
password: recipient123

Table of Contents

Features

1. Multiple user roles:

  • Admin: Assigns city admins to different cities.
  • City Admin: Verifies and approves recipients who wish to join the platform.
  • Donor: Posts surplus food or fulfills recipient food requests.
  • Recipient: Requests available food from donors or requests food requests based on their needs.

2. QR Code Verification:

  • Once a donation is made, a QR code is generated and sent via email to the donor. The recipient must scan this QR code to mark the donation as completed.

3. Email Notifications:

  • Donors receive alerts about recipient requests.
  • Recipients are notified about available food.
  • Both parties receive confirmation emails regarding donation transactions.
  • Uses BullMQ to queue email notifications.

4. Authentication & Security:

  • JWT-based authentication with protected routes on both frontend and backend.

5. Effective API Handling:

  • React Query is used for efficient API calls.

[back to top]

Platform Workflow

  • The Admin assigns a City Admin to a specific city. The platform will not be available in a city unless a City Admin has been assigned.
  • Once the platform is available, both Donors and Recipients can sign up.
  • The City Admin receives notifications for every recipient signup and must verify their credentials and authenticity to prevent misuse of the platform.
  • Donors can either post about surplus food they have or fulfill a recipient’s food request.
  • Recipients can either request food from an existing donor post or create a new food request based on their needs.
  • When a donor fulfills a food request or a recipient claims available food, the donation is set to In-Progress on a First-Come, First-Served (FCFS) basis.
  • Both the Donor and Recipient receive notifications with essential details regarding the donation.
  • The Recipient must collect the donation from the specified location and scan the QR Code (sent to the Donor via email) to mark the donation as Completed.

Contributors

[back to top]

Getting started

In order to run this container you'll need,

  • Docker installed
  • Add public/temp folders in backend
  • Setup .env in both frontend and backend
# frontend
VITE_API_URL=http://localhost:5000/api/v1/ or <backend_url>

# backend
PORT=5000
MONGODB_URL=<your_mongodb_cluster_url or local_url>
CORS_ORIGIN=http://localhost:5173 or <domain_url>
ADMIN_EMAIL=<admin_email>
TOKEN_SECRET=<your_token_secret>
EMAIL_USER=<email>
EMAIL_APP_PASS=<email_app_pass>
CLOUDINARY_CLOUD_NAME=<cloudinary_cloud_name>
CLOUDINARY_API_KEY=<api_key>
CLOUDINARY_API_SECRET=<api_key_secret>

Development stage

docker-compose -f docker-compose.yml -f docker-compose.dev.yml up

Production stage

docker-compose -f docker-compose.yml -f docker-compose.prod.yml up
  • Deploy frontend using AWS S3 & CloudFront

Preview

Home page

homepage

Login page

loginpage

Sign pages

User role selection userroleselection

Donor signup donor-signup

Recipient signup recipient-signup

Admin dashboard

admin-dashboard

Add city admin modal addcityadminmodal

City admin dashboard

city-admin-dashboard

Donor dashboard

donor-dashboard

Food post modal food-post-modal

Recipient dashboard

recipient-dashboard

Food request modal food-request-modal

Mail received by donor after donation is set in-progress

donation-complete-qr

Donation complete page (changes donation status to completed)

donation-complete

[back to top]

API Documentation

Schema

schema

Routes

User Authentication & Management

Donor Signup

  • URL: /api/v1/users/donor-signup
  • Method: POST
  • Body (form-data):
avatar: [file]
username: [string]
email: [string]
phoneNo: [string]
password: [string]
coordinates: [latitude, longitude]
address: [string]
state: [string]
city: [string]
pincode: [string]
donorType: [individual/organization]

Recipient Signup

  • URL: /api/v1/users/recipient-signup
  • Method: POST
  • Body (form-data):
avatarImage: [file]
username: [string]
email: [string]
phoneNo: [string]
password: [string]
coordinates: [latitude, longitude]
address: [string]
state: [string]
city: [string]
pincode: [string]
organizationType: [string]
registrationNo: [string]

Get User Profile

  • URL: /api/v1/users/get-user-profile
  • Method: GET

Create City Admin

  • URL: /api/v1/users/create-city-admin
  • Method: POST
  • Body (form-data):
username: [string]
email: [string]
phoneNo: [string]
password: [string]
coordinates: [latitude, longitude]
address: [string]
state: [string]
city: [string]
pincode: [string]

Login

  • URL: /api/v1/users/login
  • Method: POST
  • Body (form-data):
email: [string]
password: [string]

Get Dashboard Data

  • URL: /api/v1/users/get-dashboard-data
  • Method: GET

Logout

  • URL: /api/v1/users/logout
  • Method: POST

City Admin

Verify Recipient

  • URL: /api/v1/cityAdmin/verify-recipient/
  • Method: PATCH

Get Food Requests

  • URL: /api/v1/cityAdmin/get-food-requests
  • Method: GET

Get Food Posts

  • URL: /api/v1/cityAdmin/get-food-posts
  • Method: GET

Get Verification List

  • URL: /api/v1/cityAdmin/get-verification-list
  • Method: GET

Reject Recipient

  • URL: DELETE /api/v1/cityAdmin/verify-recipient/
  • Method: DELETE

Food Post Management

Add Food Post

  • URL: /api/v1/foodPost/add-post
  • Method: POST
  • Body (form-data):
images: [file(s)]
title: [string]
description: [string]
quantity: [number]
quantityUnit: [string]
foodType: [veg/non-veg]
bestBefore: [date]
useUserLocation: [true/false]
coordinates: [latitude, longitude]
address: [string]
state: [string]
city: [string]
pincode: [string]

Update Food Post

  • URL: /api/v1/foodPost/update-post/:postId
  • Method: PATCH
  • Body (form-data):
images: [file(s)]
title: [string]
description: [string]
quantity: [number]
quantityUnit: [string]
foodType: [veg/non-veg]
bestBefore: [date]
useUserLocation: [true/false]
coordinates: [latitude, longitude]
address: [string]
state: [string]
city: [string]
pincode: [string]

Delete Food Post

  • URL: /api/v1/foodPost/delete-post/:postId
  • Method: DELETE

Get Donor Posts

  • URL: /api/v1/foodPost/get-donor-posts
  • Method: GET

Get Available Posts

  • URL: /api/v1/foodPost/get-available-posts
  • Method: GET

Request Food

  • URL: /api/v1/foodPost/request-food/
  • Method: POST
  • Body (form-data):
title: [string]
description: [string]
quantity: [number]
quantityUnit: [string]
foodType: [veg/non-veg]
bestBefore: [date]
useUserLocation: [true/false]
coordinates: [latitude, longitude]
address: [string]
state: [string]
city: [string]
pincode: [string]

Food Requests

Add Food Request

  • URL: /api/v1/foodRequest/add-request
  • Method: POST
  • Body (form-data):
title: [string]
description: [string]
quantity: [number]
quantityUnit: [string]
foodType: [veg/non-veg]
requiredBy: [date]

Update Food Request

  • URL: /api/v1/foodRequest/update-request/
  • Method: PATCH
  • Body (form-data):
title: [string]
description: [string]
quantity: [number]
quantityUnit: [string]
foodType: [veg/non-veg]
requiredBy: [date]

Delete Food Request

  • URL: /api/v1/foodRequest/delete-request/:requestId
  • Method: DELETE

Get All Requests

  • URL: /api/v1/foodRequest/get-requests
  • Method: GET

Get Recipient Requests

  • URL: /api/v1/foodRequest/get-recipient-requests
  • Method: GET

Fulfill Request

  • URL: /api/v1/foodRequest/fulfill-request/
  • Method: POST
  • Body (form-data):
title: [string]
description: [string]
quantity: [number]
quantityUnit: [string]
foodType: [veg/non-veg]
requiredBy: [date]

Admin

Get City Admins

  • URL: /api/v1/admin/get-city-admins
  • Method: GET

Remove City Admin

  • URL: /api/v1/admin/remove-city-admin/:id
  • Method: DELETE

[back to top]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages