Food Rescue Connect is a full-stack web application designed to combat food waste by connecting users with local stores and restaurants offering surplus food bags at discounted prices. The platform supports three user roles: regular customers, shop owners, and administrators, each with tailored functionality.
-
Browse Establishments: View an alphabetically sorted list of participating stores and restaurants, including their location, contact details, and food category. (Publicly accessible)
-
View Available Bags: Logged-in users can see available "Surplus Bags" for each establishment, categorized as:
- Surprise Bags: Assorted items at a discounted price (contents hidden until pickup).
- Normal Bags: Specific items and quantities listed with full transparency.
-
Bag Details: View bag type, size (Small, Medium, Large), price, and pickup time window (only future times are available).
-
Shopping Cart: Add desired bags to a personal cart with smart constraints:
- Fairness Rule: Users can only reserve one bag per establishment per day.
- Real-time availability checking prevents double-booking.
-
Customize Normal Bags: Remove up to two individual food items from a "Normal Bag" before finalizing the reservation (price remains unchanged).
-
Reservation Management:
- Confirm cart contents to reserve bags with real-time availability verification.
- If any bag becomes unavailable during checkout, the entire transaction is cancelled with clear feedback.
- View and cancel confirmed reservations, making bags available again for other users.
-
User Authentication: Secure registration and login with password hashing and session management.
-
Dedicated Shop Panel: Shop owners have their own management dashboard accessible after login.
-
Inventory Management:
- Create new boxes (Normal or Surprise) with customizable items, prices, sizes, and pickup times.
- Boxes are automatically assigned to their shop upon creation.
- Delete available boxes (cannot delete boxes with active reservations).
-
Reservation Control:
- View all boxes with their current status (Available/Reserved).
- Cancel customer reservations to make boxes available again.
- Monitor reservation activity in real-time.
-
Shop Information: View shop details including address, phone, and food type.
-
Comprehensive Admin Panel with three main sections:
-
Create New:
- Create shops with full details (name, address, phone, food type).
- Create food items for the catalog (used in Normal bags).
- Create boxes with custom specifications and contents.
-
Manage:
- View all shops, boxes, and food items in the system.
- Real-time statistics and status monitoring.
- Assign boxes to shops or directly to users.
-
Assignments:
- Manage box-shop relationships.
- Create shop owner user accounts linked to specific shops.
- Remove box assignments from shops.
-
- Regular Users: Browse shops, reserve bags, manage personal reservations.
- Shop Owners: Manage their own shop's inventory and reservations.
- Administrators: Full system access to create and manage shops, boxes, items, and user accounts.
- Frontend: React, React Router, React Bootstrap, Bootstrap Icons
- Backend: Node.js, Express.js
- Authentication: Passport.js (Local Strategy with sessions)
- Database: SQLite with foreign key constraints
- Communication: RESTful API with CORS configuration
- Security: Password hashing with crypto.scrypt, secure session cookies
- Users: User accounts with roles (admin, shop owner, regular user)
- Shops: Store/restaurant information
- Boxes: Food bags with type, size, price, and time specifications
- Contents: Catalog of available food items
- Boxcontent: Junction table linking boxes to their contents with quantities
- Boxinshop: Junction table linking boxes to shops
- Purchases: User reservations of boxes
POST /api/session- User loginDELETE /api/session- User logoutGET /api/session/current- Get current sessionPOST /api/register- Register new user
GET /api/shops- Fetch all shopsGET /api/boxes/:shopId- Fetch boxes for a specific shopPOST /api/boxes-by-ids- Fetch specific boxes by IDsPOST /api/purchase- Create new purchasePOST /api/Purchases-modifications- Modify purchases (add/remove boxes and items)DELETE /api/purchase- Delete user's purchasesGET /api/items- Get available food items
GET /api/shop/current- Get current shop informationGET /api/shop/boxes- Get boxes for current shopPOST /api/shop/boxes- Create new box for shopDELETE /api/shop/boxes/:boxId- Delete boxDELETE /api/shop/purchases/:boxId- Cancel a reservation
POST /api/admin/shops- Create new shopPOST /api/admin/boxes- Create new boxPOST /api/admin/items- Create new food itemPOST /api/admin/add-item-to-box- Add item to boxPOST /api/admin/assign-box-shop- Assign box to shopPOST /api/admin/assign-box-user- Assign box to userDELETE /api/admin/remove-box-shop- Remove box from shopPOST /api/admin/create-shop-user- Create shop owner accountGET /api/admin/users- Get all users
- Node.js (v14 or higher)
- npm or yarn
- Clone the repository:
git clone <https://github.com/frontinus/recupero-cibo.git>
cd <recuper-cibo>- Install Server Dependencies:
cd server
npm install- Install Client Dependencies:
cd client
npm install- Start the Server:
cd server
nodemon index.js
# Or: node index.jsServer will run on http://localhost:3001
- Start the Client (in a new terminal):
cd client
npm run devClient will run on http://localhost:5173
- Regular Users: polpop (password:
polpop) (also a shop owner) - Admin: admin (password:
admin) - Shop Owners: Create via admin panel after setting up shops
- Real-time Availability: Prevents overbooking with database-level checks.
- Time-based Pickup Windows: Only shows bags with future pickup times.
- Customizable Normal Bags: Users can remove unwanted items (up to 2) before purchase.
- Transactional Integrity: All purchase modifications use database transactions.
- Role-based Access Control: Three-tier permission system (user, shop owner, admin).
- Responsive Design: Works on desktop and mobile devices.
- User-friendly Interface: Clean, modern UI with Bootstrap components.
├── client/
│ ├── src/
│ │ ├── components/
│ │ ├── API.jsx # API communication layer
│ │ ├── App.jsx # Main app component
│ │ ├── AdminPanel.jsx # Admin dashboard
│ │ ├── ShopOwnerPanel.jsx # Shop owner dashboard
│ │ ├── LoginForm.jsx # Authentication forms
│ │ ├── ShopsList.jsx # Shop browsing
│ │ ├── Purchases.jsx # Cart management
│ │ └── ...
│ └── package.json
├── server/
│ ├── database.js # Database operations
│ ├── authentication.js # Passport.js config
│ ├── index.js # Express server & routes
│ └── package.json
└── README.md
- Email notifications for reservations
- Shop analytics and reporting
- User reviews and ratings
- Multi-language support
- Mobile app version
- Payment integration
- Advanced search and filtering
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.
For questions or support, please send me an email @ francesco1.abate@yahoo.com