Skip to content

i-ces/RedSoil

Repository files navigation

Redsoil - Find Blood Donor Quickly

A VECTORHACK2026 Hackathon Project

Project Overview

Redsoil is a fast, efficient, and completely free geolocation-based donor discovery app. It enables organizations (hospitals, blood banks) to instantly find available blood donors near them, and allows individual donors to contribute to life-saving causes. No fees, no subscriptions—just instant connectivity when lives are on the line.

Problem Statement

During blood emergencies, every second counts. Organizations (i.e. Hospitals, Clubs, Medical centers, etc) struggle to quickly locate compatible blood donors in their area. Traditional methods are slow, inefficient, and often result in delayed response times. Redsoil solves this with lightning-fast, location-based donor discovery.

Mission

To make blood donor discovery instant, effortless, and accessible to everyone—helping, anyone can find donors in seconds, not hours.


Team Members

  • Ashish Saud - Full Stack Development
  • Mahesh Udas - Backend & Database Architecture
  • Sabin Dhakal - Frontend & UX Design

Key Features

For Donors

  • Quick Registration - 30-second signup with GPS location
  • One-Time Setup - Set blood type and location, you're live
  • Instant Alerts - Get notified when your blood type is urgently needed
  • Lightweight & Fast - Optimized for mobile with minimal data usage
  • Quick Response - Direct SMS contact with organizations
  • Completely Free - No hidden fees or subscriptions

For Organizations

  • Ultra-Fast Search - Find compatible donors in seconds, not hours
  • Smart Filtering - Blood type + radius = instant results
  • Efficient Donor List - Sorted by proximity for optimal response time
  • Instant Alerts - Send SMS & email to multiple donors simultaneously
  • Map View - See donors on interactive map with exact distances
  • Completely Free - No subscription costs
  • Verified Data - Real-time donor availability status

Platform Features

  • Lightning-Fast Search - Optimized queries with MongoDB geospatial indexing
  • Visual Discovery - Leaflet maps for quick donor location view
  • Secure & Private - Role-based access, encrypted data
  • Multi-Channel Alerts - Email and SMS in real-time
  • Accurate Distance - Haversine algorithm for precise calculations
  • Scalable Backend - Designed for high-volume donor discovery

Technology Stack

Frontend

  • Framework: Next.js 16.1.6 (App Router + Turbopack)
  • UI Library: React 19 with TypeScript
  • Styling: Tailwind CSS
  • Component Library: shadcn/ui
  • Maps: Leaflet + React-Leaflet

Backend

  • Framework: Next.js API Routes
  • Authentication: NextAuth v5.0.0-beta.30 (JWT strategy)
  • Database: MongoDB with Mongoose ODM
  • Email Service: Nodemailer (SMTP)
  • SMS Service: Twilio / SMS API
  • Geolocation: Nominatim Reverse Geocoding API

Map & Geolocation

  • Map Provider: OpenStreetMap (OSM)
  • Map Library: Leaflet with React-Leaflet
  • Reverse Geocoding: Nominatim (OpenStreetMap API)

Redsoil integrates OpenStreetMap to provide a fast, free, and open-source mapping solution for donor discovery. Donor and organization locations are stored as geospatial coordinates and visualized on an interactive map.

  • Real-time donor visualization based on GPS coordinates
  • Radius-based search using MongoDB 2dsphere geospatial indexing
  • Accurate distance calculation using the Haversine formula
  • Live map updates when blood type or distance filters change
  • Privacy-focused design with no public exposure of exact donor locations

Infrastructure & Tools

  • Runtime: Node.js
  • Package Manager: npm
  • Version Control: Git
  • Deployment Ready: Vercel compatible

Project Structure

redsoil/
├── app/
│   ├── api/                 # API routes
│   │   ├── alert/           # Email alert endpoint
│   │   ├── auth/            # NextAuth & registration routes
│   │   ├── donors/          # Donor management
│   │   ├── org/             # Organization endpoints
│   │   └── search/          # Donor search by geolocation
│   ├── auth/                # Authentication pages (login/register)
│   ├── dashboard/           # User dashboards
│   │   ├── donor/           # Donor dashboard
│   │   └── org/             # Organization dashboard
│   ├── search/              # Public search pages
│   ├── terms-privacy/       # T&C and Privacy Policy
│   └── layout.tsx           # Root layout
│
├── components/              # React components
│   ├── ui/                  # shadcn/ui components
│   ├── layout/              # Navbar, Sidebar
│   ├── dashboard/           # Dashboard-specific components
│   ├── landing/             # Home page components
│   ├── donor/               # Donor-specific components
│   └── providers/           # Context providers
│
├── lib/
│   ├── auth.ts              # NextAuth configuration
│   ├── db.ts                # MongoDB connection
│   ├── geo.ts               # Geolocation utilities
│   ├── email.ts             # Email service
│   ├── constants.ts         # App constants
│   ├── validations.ts       # Zod schemas
│   └── utils.ts             # Helper utilities
│
├── models/
│   └── User.ts              # Mongoose schemas (Donor & Organization)
│
├── types/
│   └── index.ts             # TypeScript interfaces
│
└── public/                  # Static assets

Getting Started

Prerequisites

  • Node.js 18+
  • MongoDB instance (local or Atlas)
  • SMTP credentials (Gmail, SendGrid, etc.)
  • Optional: Twilio account for SMS

Installation

# Clone the repository
git clone <repo-url>
cd redsoil

# Install dependencies
npm install

# Set up environment variables
cp sample.env .env.local
# Edit .env.local with your credentials

# Run development server
npm run dev

Environment Variables

# MongoDB Connection
# Replace <db_password> with your MongoDB Atlas password
MONGODB_URI=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/<database_name>

# Email (SMTP) - Configure with your email service provider
# For Gmail: smtp.gmail.com, port 587
# For SendGrid/Brevo: Check their documentation
SMTP_HOST=smtp.your-email-provider.com
SMTP_PORT=587
SMTP_USER=your-smtp-username
SENDER_EMAIL=your-email@example.com
SMTP_PASS=your-smtp-password
ALERT_FROM_EMAIL=alerts@yourdomain.com

# NextAuth Secret
# Generate a secure random string (at least 32 characters)
# You can use: openssl rand -base64 32
AUTH_SECRET=your-random-secret-string-at-least-32-characters-long
NEXTAUTH_URL=http://localhost:3000

# App
NEXT_PUBLIC_APP_URL=http://localhost:3000

# Twilio SMS Service (Optional - for SMS functionality)
# Get credentials from https://www.twilio.com/console
TWILIO_SID=your-twilio-account-sid
TWILIO_AUTH_TOKEN=your-twilio-auth-token
TWILIO_PHONE_NUMBER=+1234567890

Usage Guide

For Donors

  1. Register - Sign up with email, phone, and blood type (takes 30 seconds)
  2. Set Location - Use GPS to pinpoint your location
  3. Go Live - You're now findable by organizations
  4. Receive Alerts - Get instant SMS/email when needed
  5. Help Save Lives - Respond to urgent requests in your area

For Organizations

  1. Register - Sign up as hospital/blood bank (takes 1 minute)
  2. Set Location - Register your facility's location
  3. Search Donors - Click Search, select blood type & radius
  4. Find Results - See all compatible donors near you in seconds
  5. Send Alerts - Contact top candidates via SMS instantly

Public Guest Search

  • View available donors without registration
  • Filter by blood type and distance
  • See donor locations on map
  • No data collection or tracking

Data Privacy & Security

  • Phone Numbers - Used exclusively for emergency contact and SMS alerts
  • Email Addresses - Used for account updates and email notifications
  • Location Data - Stored securely for geolocation matching only
  • GDPR Compliant - Clear T&C and Privacy Policy documented
  • Password Security - Hashed passwords with industry-standard algorithms

API Documentation

Key Endpoints

Search Donors (Registered Donor and Guest)

GET /api/search?lat=27.7172&lng=85.3240&radius=5000&bloodType=O+

Register Donor

POST /api/auth/register/donor
{
  "name": "John Doe",
  "email": "john@example.com",
  "phone": "9800000000",
  "bloodType": "O+",
  "location": { "lat": 27.7172, "lng": 85.3240 }
}

Send Alert

POST /api/alert
{
  "recipientEmail": "john@example.com",
  "donorName": "John Doe",
  "bloodType": "O+",
  "urgency": "emergency",
  "message": "Blood needed urgently..."
}

What Makes Redsoil Different

Speed - Find donors in seconds, not hours
Free - No subscription, no hidden fees, no costs
Efficient - Smart filtering gets you the right donors fast
Accurate - Real-time location matching with precision
Private - Zero data selling, completely secure
Scalable - Built to handle high-volume emergency situations


Database Schema

User Model (Discriminator Pattern)

  • Base: username, email, phone, password, location
  • Donor: bloodType, isAvailable, lastDonationDate
  • Organization: orgName, address, isPremium, points

Features

  • Geospatial indexing (2dsphere) for location queries
  • Timestamps for all records
  • Role-based access control

Future Enhancements

  • Analytics Dashboard for organizations
  • Donor Rewards Program
  • Native Mobile Apps (iOS/Android)
  • AI-powered donor matching
  • Integration with blood bank inventory systems
  • Multi-language support
  • Hospital partnership integration

License

This project is created for VECTORHACK2026 hackathon. All rights reserved by the development team.


Contributing

This hackathon project welcomes feedback and suggestions. Please feel free to reach out to the team members.


Made with love by Ashish Saud, Mahesh Udas, and Sabin Dhakal

Connecting donors, saving lives.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •