Skip to content

community-driven platform where users can list and share medicine pantries, making healthcare more accessible to everyone. Connect with local pantries, browse available medicines, and contribute to a healthier community.

Notifications You must be signed in to change notification settings

Rohanpawar9921/MedShare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MedShare β€” Community Donating & Medicine Supply Exchange

Live Demo: https://medshare-mruy.onrender.com/

MedShare is a full-stack web application that connects people who have surplus medical supplies with those in need. The platform streamlines donation listings, request fulfillment, and location-based discovery to help essential medical items reach the right people quickly.


Node.js MongoDB Express EJS


πŸš€ Features

  • Role-Based Access Control: Three user roles β€” Donor, Seeker, and Admin β€” with tailored dashboards and permissions
  • Donation & Request Management: Create, edit, and manage donation listings; submit and track requests with lifecycle status updates
  • Location-Aware Search: Interactive maps powered by Mapbox to discover nearby available supplies
  • Image Uploads: Cloudinary integration for secure image storage and display
  • Availability Tracking: Real-time status updates for donations (available, reserved, fulfilled)
  • Pentris Review System: Users can leave reviews and ratings for donors and seekers to build community trust
  • Admin Tools: Admin dashboard for user management, donation oversight, and platform moderation
  • Responsive UI: Mobile-friendly design built with EJS templates, Bootstrap 5, and custom CSS

πŸ› οΈ Tech Stack

Backend

  • Node.js (v22.6.0)
  • Express.js
  • MongoDB Atlas (Database)
  • Passport.js (Authentication)
  • Express-Session (Session Management)

Frontend

  • EJS (Embedded JavaScript Templates)
  • Bootstrap 5
  • Custom CSS

Integrations

  • Cloudinary: Image upload and storage
  • Mapbox: Interactive maps and location-based search
  • dotenv: Environment variable management

Key Packages

  • @mapbox/mapbox-sdk - Interactive map integration
  • cloudinary - Image storage and delivery
  • connect-flash - Flash messages
  • connect-mongo - MongoDB session store
  • cookie-parser - Cookie handling
  • joi - Schema validation
  • method-override - RESTful routing
  • multer & multer-storage-cloudinary - Image upload handling
  • passport, passport-local, passport-local-mongoose - Authentication
  • nodemailer - Email service integration

οΏ½ Installation & Setup

Prerequisites

  • Node.js (v22.6.0 or higher)
  • MongoDB Atlas account (or local MongoDB instance)
  • Cloudinary account
  • Mapbox account

1. Clone the repository

git clone https://github.com/Rohanpawar9921/MedShare.git
cd MedShare

2. Install dependencies

npm install

3. Set up environment variables

Create a .env file in the root directory and add:

# Cloudinary Configuration
CLOUD_NAME=your_cloudinary_cloud_name
CLOUD_API_KEY=your_cloudinary_api_key
CLOUD_API_SECRETE=your_cloudinary_api_secret

# Mapbox
MAP_TOKEN=your_mapbox_token

# MongoDB Atlas
ATLASDB_URL=your_mongodb_atlas_connection_string

# Session Secret
SECRETE=your_session_secret

# Email Configuration (Optional)
SMTP2GO_HOST=smtp.gmail.com
SMTP2GO_PORT=587
SMTP2GO_USERNAME=your_email_username
SMTP2GO_PASSWORD=your_email_password
SMTP2GO_FROM_EMAIL=your_from_email
SMTP2GO_FROM_NAME=Community-MedShare

4. Seed the database (optional)

node init/index.js

5. Run the application

npm start

The app will be available at http://localhost:8080


οΏ½ Usage

For Donors

  1. Sign up and create a donor account
  2. Add donation listings with images, description, quantity, and location
  3. Manage availability and status of your donations
  4. Receive and respond to requests from seekers

For Seekers

  1. Sign up and create a seeker account
  2. Browse available donations using search and map filters
  3. Submit requests for needed medical supplies
  4. Track request status and receive notifications
  5. Leave reviews for donors after successful fulfillment

For Admins

  1. Access admin dashboard with elevated privileges
  2. Manage users, donations, and requests
  3. Monitor platform activity and moderate content
  4. Handle reported issues and user disputes

οΏ½ Project Structure

MedShare/
β”œβ”€β”€ app.js                  # Main application entry point
β”œβ”€β”€ cloudConfig.js          # Cloudinary configuration
β”œβ”€β”€ middleware.js           # Custom middleware (auth, validation)
β”œβ”€β”€ schema.js              # Joi validation schemas
β”œβ”€β”€ package.json           # Dependencies and scripts
β”œβ”€β”€ controllers/           # Business logic
β”‚   β”œβ”€β”€ listings.js        # Donation listing controllers
β”‚   β”œβ”€β”€ reviews.js         # Review controllers
β”‚   └── users.js           # User authentication controllers
β”œβ”€β”€ models/                # MongoDB schemas
β”‚   β”œβ”€β”€ listing.js         # Donation listing model
β”‚   β”œβ”€β”€ review.js          # Review model
β”‚   └── user.js            # User model
β”œβ”€β”€ routes/                # Express routes
β”‚   β”œβ”€β”€ medpantry.js       # Donation routes
β”‚   β”œβ”€β”€ review.js          # Review routes
β”‚   └── user.js            # Authentication routes
β”œβ”€β”€ views/                 # EJS templates
β”‚   β”œβ”€β”€ listings/          # Donation views
β”‚   β”œβ”€β”€ users/             # Auth & home views
β”‚   β”œβ”€β”€ includes/          # Reusable components (navbar, footer, flash)
β”‚   └── layouts/           # Layout templates
β”œβ”€β”€ public/                # Static assets
β”‚   β”œβ”€β”€ css/               # Stylesheets
β”‚   └── js/                # Client-side scripts
β”œβ”€β”€ init/                  # Database seeding
β”‚   β”œβ”€β”€ data.js            # Sample donation data
β”‚   └── index.js           # Seeding script
└── utils/                 # Utility functions
    β”œβ”€β”€ emailService.js    # Email service helpers
    β”œβ”€β”€ ExpressError.js    # Custom error handling
    └── wrapAsync.js       # Async error wrapper

πŸ—„οΈ Database Schema

Listing Model (Donation)

{
  title: String,           // e.g., "Paracetamol 500mg"
  description: String,     // Details about the donation
  image: {
    url: String,
    filename: String
  },
  price: Number,          // Quantity available
  location: String,       // City/area
  country: String,        // Country
  reviews: [Review],      // Array of review references
  owner: User,            // Donor user reference
  geometry: {             // GeoJSON for maps
    type: "Point",
    coordinates: [lng, lat]
  }
}

User Model

{
  email: String,
  username: String,
  password: String (hashed),
  role: String            // donor, seeker, or admin
}

Review Model

{
  comment: String,
  rating: Number,         // 1-5 stars
  author: User,
  createdAt: Date
}

πŸ” Security Features

  • Password Hashing: User passwords are hashed using Passport Local Mongoose
  • Session Management: Secure session handling with express-session and connect-mongo
  • Role-Based Authorization: Middleware to protect routes based on user roles
  • Input Validation: Server-side validation using Joi for all user inputs
  • Environment Variables: Sensitive credentials stored securely in .env file
  • CSRF Protection: Flash messages and form validation

🌐 Deployment

The application is deployed on Render.

Deploy to Render

  1. Create a new Web Service on Render
  2. Connect your GitHub repository
  3. Set the following:
    • Build Command: npm install
    • Start Command: npm start
  4. Add all environment variables from .env in Render dashboard
  5. Deploy!

🀝 Contributing

Contributions are welcome! Please follow these steps:

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

Areas for Contribution:

  • πŸ› Bug fixes
  • ✨ New features (request/fulfillment workflow, notifications)
  • πŸ“ Documentation improvements
  • 🎨 UI/UX enhancements
  • πŸ”’ Security improvements
  • πŸ§ͺ Testing coverage

πŸ“ Future Enhancements

  • Real-time notifications for new requests
  • In-app messaging between donors and seekers
  • Advanced search filters (medicine type, expiry date)
  • Inventory tracking and alerts
  • Email notifications for request lifecycle
  • Mobile app (React Native)
  • Multi-language support
  • Analytics dashboard for admins

πŸ“œ License

This project is licensed under the MIT License.


πŸ‘¨β€πŸ’» Author

Rohan Pawar


πŸ™ Acknowledgments


οΏ½ Screenshots

Add screenshots of your application here showing key features like donation listings, map view, user dashboard, etc.


Made with ❀️ for the community

About

community-driven platform where users can list and share medicine pantries, making healthcare more accessible to everyone. Connect with local pantries, browse available medicines, and contribute to a healthier community.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published