https://github.com/ismail-dev-code/meal-giver-server
The MealGiver Server is the core API service for the MealGiver platform โ a MERN stack-based food donation and redistribution system connecting restaurants with verified charities and individuals to reduce food waste.
https://github.com/ismail-dev-code/meal-giver-server
decoded dotenv express-js firebse middleware mongodb-atlas stripe-payments
Last synced: 6 months ago
JSON representation
The MealGiver Server is the core API service for the MealGiver platform โ a MERN stack-based food donation and redistribution system connecting restaurants with verified charities and individuals to reduce food waste.
- Host: GitHub
- URL: https://github.com/ismail-dev-code/meal-giver-server
- Owner: ismail-dev-code
- Created: 2025-07-16T13:48:35.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-08-17T09:42:10.000Z (7 months ago)
- Last Synced: 2025-08-17T11:33:30.926Z (7 months ago)
- Topics: decoded, dotenv, express-js, firebse, middleware, mongodb-atlas, stripe-payments
- Language: JavaScript
- Homepage: https://meal-giver.web.app
- Size: 42 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ฝ๏ธ MealGiver Server API
The **MealGiver Server** is the core API service for the MealGiver platform โ a MERN stack-based food donation and redistribution system connecting restaurants with verified charities and individuals to reduce food waste.
## ๐ Live
> โ๏ธ Site: `https://meal-giver-web.app`
## โ๏ธ Technologies Used
- **Node.js**
- **Express.js**
- **MongoDB**
- **Firebase Admin SDK (Authentication & Role Management)**
- **Stripe API (Payments)**
- **Dotenv**
- **CORS**
- **Firebase Token Verification**
## ๐ Authentication & Middleware
- **Firebase Authentication** (`verifyFBToken`)
- **Role-based Authorization** (`verifyAdmin`, `verifyRestaurant`, `verifyCharity`)
## ๐ ๏ธ Base URL
> `https://mealgiver-server.vercel.app`
## โ
Auth & User Endpoints
| Method | Endpoint | Access | Description |
| -------- | -------------------- | ------------- | -------------------------- |
| `GET` | `/users` | Admin | Get all users |
| `POST` | `/users` | Public | Register a new user |
| `PATCH` | `/users/role/:email` | Admin | Update a userโs role |
| `DELETE` | `/users/:id` | Admin | Delete a user |
| `GET` | `/users/role/:email` | Authenticated | Get current user's role |
## ๐ฝ๏ธ Donations Endpoints
| Method | Endpoint | Access | Description |
| -------- | ------------------------ | ---------- | ---------------------------------- |
| `POST` | `/donations` | Restaurant | Create a new donation |
| `GET` | `/donations/restaurant` | Restaurant | Get all donations by restaurant |
| `PATCH` | `/donations/:id` | Restaurant | Update a donation |
| `DELETE` | `/donations/:id` | Restaurant | Delete a donation |
| `GET` | `/donations/featured` | Public | Get featured donations |
| `GET` | `/donations/verified` | Public | Get all verified donations |
| `GET` | `/donations/:id` | Public | Get donation details |
| `PATCH` | `/donations/approve/:id` | Admin | Approve a donation submission |
## ๐ฆ Donation Request Endpoints
| Method | Endpoint | Access | Description |
| ------- | --------------------------------- | ---------- | -------------------------------------------- |
| `POST` | `/requests` | Charity | Submit request for a donation |
| `GET` | `/requests/charity` | Charity | Get all requests by the logged-in charity |
| `GET` | `/requests/restaurant` | Restaurant | Get all requests for restaurantโs donations |
| `PATCH` | `/requests/:id/approve` | Restaurant | Approve a charityโs request |
| `PATCH` | `/requests/:id/reject` | Restaurant | Reject a charityโs request |
| `GET` | `/charity/received-donations` | Charity | Get all received/picked-up donations |
| `GET` | `/charity/latest-requests/recent` | Public | Get recent charity requests (for homepage) |
## ๐ Pickup Confirmation Endpoints
| Method | Endpoint | Access | Description |
| ------- | ----------------------------- | ------- | ------------------------ |
| `GET` | `/charity/my-pickups` | Charity | Get all assigned pickups |
| `PATCH` | `/charity/pickup-confirm/:id` | Charity | Confirm a pickup |
## ๐ณ Charity Role Requests (Stripe)
| Method | Endpoint | Access | Description |
| ------- | -------------------------- | ------ | -------------------------------- |
| `POST` | `/charity-role-request` | Auth | Submit role request with payment |
| `GET` | `/admin/role-requests` | Admin | View all role requests |
| `PATCH` | `/admin/role-requests/:id` | Admin | Approve or reject role request |
| `POST` | `/create-payment-intent` | Auth | Generate Stripe payment intent |
## ๐ Review Endpoints
| Method | Endpoint | Access | Description |
| ------ | ------------------------- | ------- | ----------------------------------- |
| `POST` | `/reviews` | Charity | Submit a review for a donation |
| `GET` | `/reviews?donationId=xxx` | Public | Get reviews for a specific donation |
| `GET` | `/reviews/mine` | Charity | Get logged-in user's reviews |
| `GET` | `/reviews/community` | Public | Get latest community stories |
## ๐ Dashboard Stats
| Method | Endpoint | Access | Description |
| ------ | ------------------- | ---------- | --------------------------------------- |
| `GET` | `/admin/stats` | Admin | Get total stats (users, donations, etc) |
| `GET` | `/restaurant/stats` | Restaurant | Restaurant-specific stats |
| `GET` | `/charity/stats` | Charity | Charity-specific stats |
## ๐งช Testing the API
You can test the endpoints using:
- ๐งช Postman
- โ๏ธ Frontend app integration
All secured routes require this header:
`Authorization: Bearer `
## ๐ Contributing
Feel free to fork the project, open issues, or submit PRs. Contributions, suggestions, and feedback are always welcome!
## ๐งโ๐ป Developer
**Ismail Hossain**
๐ง hm.ismail772@gmail.com
๐ Noakhali, Bangladesh
๐ [GitHub](https://github.com/ismail-dev-code) | [LinkedIn](https://www.linkedin.com/in/ismail-hossain24)