Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌱 ImpactMatch β€” AI-Powered Volunteer Matching Platform

A production-ready MERN stack application that connects volunteers with organizations using a hybrid AI matching system, with GPS-verified attendance, mentorship, and digital certificate generation.


πŸ“¦ Project Structure

impactmatch/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ config/db.js                 # MongoDB connection
β”‚   β”œβ”€β”€ controllers/                 # Route handlers (MVC)
β”‚   β”‚   β”œβ”€β”€ authController.js
β”‚   β”‚   β”œβ”€β”€ opportunityController.js
β”‚   β”‚   β”œβ”€β”€ applicationController.js
β”‚   β”‚   β”œβ”€β”€ attendanceController.js
β”‚   β”‚   β”œβ”€β”€ certificateController.js
β”‚   β”‚   β”œβ”€β”€ mentorshipController.js
β”‚   β”‚   └── matchingController.js
β”‚   β”œβ”€β”€ middleware/
β”‚   β”‚   β”œβ”€β”€ auth.js                  # JWT protect + role authorize
β”‚   β”‚   └── validate.js              # express-validator rules
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ User.js
β”‚   β”‚   β”œβ”€β”€ Opportunity.js
β”‚   β”‚   β”œβ”€β”€ Application.js
β”‚   β”‚   β”œβ”€β”€ Mentorship.js
β”‚   β”‚   β”œβ”€β”€ Attendance.js
β”‚   β”‚   └── Certificate.js
β”‚   β”œβ”€β”€ routes/                      # Express route definitions
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   └── certificateService.js    # PDF generation
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”œβ”€β”€ matchingAlgorithm.js     # Hybrid AI matching
β”‚   β”‚   β”œβ”€β”€ haversine.js             # GPS distance calculation
β”‚   β”‚   └── generateToken.js         # JWT creation
β”‚   β”œβ”€β”€ scripts/seed.js              # Database seeding
β”‚   β”œβ”€β”€ Dockerfile
β”‚   β”œβ”€β”€ .env.example
β”‚   └── server.js
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ public/index.html
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ Navbar.js
β”‚   β”‚   β”‚   β”œβ”€β”€ ProtectedRoute.js
β”‚   β”‚   β”‚   └── OpportunityCard.js
β”‚   β”‚   β”œβ”€β”€ context/AuthContext.js   # Global auth state
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”‚   β”œβ”€β”€ Login.js
β”‚   β”‚   β”‚   β”œβ”€β”€ Register.js
β”‚   β”‚   β”‚   β”œβ”€β”€ Dashboard.js         # Role-aware router
β”‚   β”‚   β”‚   β”œβ”€β”€ VolunteerDashboard.js
β”‚   β”‚   β”‚   β”œβ”€β”€ OrganizationDashboard.js
β”‚   β”‚   β”‚   β”œβ”€β”€ MentorDashboard.js
β”‚   β”‚   β”‚   β”œβ”€β”€ Opportunities.js     # AI-ranked listing
β”‚   β”‚   β”‚   β”œβ”€β”€ PostOpportunity.js
β”‚   β”‚   β”‚   β”œβ”€β”€ Applications.js      # With GPS check-in
β”‚   β”‚   β”‚   β”œβ”€β”€ Mentorship.js
β”‚   β”‚   β”‚   β”œβ”€β”€ Certificates.js
β”‚   β”‚   β”‚   └── VerifyCertificate.js # Public verification
β”‚   β”‚   β”œβ”€β”€ services/api.js          # Axios with interceptors
β”‚   β”‚   └── App.js
β”‚   β”œβ”€β”€ Dockerfile
β”‚   └── nginx.conf
β”‚
└── docker-compose.yml

πŸš€ Quick Start (Local Development)

Prerequisites

  • Node.js 18+
  • MongoDB 6+ (local or Atlas)
  • npm or yarn

1. Clone and Install

git clone <your-repo>
cd impactmatch

# Install backend dependencies
cd backend
npm install

# Install frontend dependencies
cd ../frontend
npm install

2. Configure Environment

# Backend
cd backend
cp .env.example .env
# Edit .env with your values:
# - MONGO_URI: your MongoDB connection string
# - JWT_SECRET: a long random secret (min 32 chars)
# - CLIENT_URL: http://localhost:3000

# Frontend (optional β€” proxy is pre-configured)
cd ../frontend
cp .env.example .env

3. Seed Database (Optional)

cd backend
npm run seed
# Creates: org@impactmatch.com, volunteer@impactmatch.com, mentor@impactmatch.com
# All passwords: password123

4. Run the Application

# Terminal 1: Start backend
cd backend
npm run dev          # nodemon with hot reload

# Terminal 2: Start frontend
cd frontend
npm start            # React dev server on :3000

Visit: http://localhost:3000


🐳 Docker Deployment

# Build and start all services
JWT_SECRET=your_secret_here docker-compose up --build

# Stop
docker-compose down

# Stop and remove volumes
docker-compose down -v

Services:


πŸ”‘ API Reference

Authentication

Method Endpoint Access Description
POST /api/auth/register Public Register new user
POST /api/auth/login Public Login, returns JWT
GET /api/auth/me Private Get current user
PUT /api/auth/profile Private Update profile

Opportunities

Method Endpoint Access Description
GET /api/opportunities Public List all (paginated)
GET /api/opportunities/my Organization My listings
GET /api/opportunities/:id Public Single opportunity
POST /api/opportunities Organization Create listing
PUT /api/opportunities/:id Organization Update
DELETE /api/opportunities/:id Organization Delete

AI Matching

Method Endpoint Access Description
GET /api/matching/opportunities Volunteer AI-ranked opportunities
GET /api/matching/score/:id Volunteer Score for one opportunity

Applications

Method Endpoint Access Description
POST /api/applications Volunteer Apply to opportunity
GET /api/applications/my Volunteer My applications
GET /api/applications/opportunity/:id Organization Applicants
PUT /api/applications/:id/status Organization Accept/Reject/Complete

Attendance

Method Endpoint Access Description
POST /api/attendance/checkin Volunteer GPS check-in
POST /api/attendance/checkout Volunteer GPS check-out
GET /api/attendance/my Volunteer My attendance history

Certificates

Method Endpoint Access Description
POST /api/certificates/issue/:applicationId Organization Issue certificate
GET /api/certificates/my Volunteer My certificates
GET /api/certificates/verify/:code Public Verify certificate

Mentorship

Method Endpoint Access Description
GET /api/mentorship/mentors Authenticated Available mentors
POST /api/mentorship/request Volunteer Request a mentor
GET /api/mentorship/my Volunteer My mentorships
GET /api/mentorship/requests Mentor Requests received
PUT /api/mentorship/:id/respond Mentor Accept/Reject
POST /api/mentorship/:id/session Mentor Add session notes
PUT /api/mentorship/:id/complete Mentor Approve completion

πŸ€– AI Matching Algorithm

Located in backend/utils/matchingAlgorithm.js:

Final Score = (0.4 Γ— interestMatch) + (0.3 Γ— skillMatch) + (0.3 Γ— semanticScore)
  • Interest Match: Jaccard similarity between volunteer interests and opportunity categories
  • Skill Match: Jaccard similarity between volunteer skills and required skills
  • Semantic Match: Cosine similarity between embedding vectors (placeholder β€” replace generateEmbedding() with OpenAI embeddings or HuggingFace sentence-transformers for production)

Returns:

{
  "matchScore": 0.72,
  "matchPercentage": 72,
  "matchedSkills": ["Python", "Teaching"],
  "skillGap": ["Leadership"],
  "categoryMatched": true,
  "semanticScore": 0.68,
  "breakdown": {
    "interestMatch": 0.80,
    "skillMatch": 0.67,
    "semanticScore": 0.68
  }
}

πŸ“ GPS Attendance Verification

Check-in requires the volunteer to be within CHECK_IN_RADIUS_METERS (default: 200m) of the opportunity location.

The Haversine formula is used to compute great-circle distance. Remote opportunities skip location validation.


πŸ“œ Certificate Flow

  1. Volunteer applies and gets accepted
  2. Volunteer checks in and out via GPS
  3. Organization marks application as "completed"
  4. Organization issues certificate via /api/certificates/issue/:applicationId
  5. System generates a PDF with unique verificationCode
  6. Anyone can verify at /verify/:code (public endpoint)

πŸ”’ Security Architecture

  • JWT: HS256, configurable expiration, validated on every protected route
  • bcrypt: Cost factor 12 for password hashing
  • Role-based middleware: authorize('volunteer', 'organization') guards
  • Input validation: express-validator on all mutation endpoints
  • CORS: Restricted to CLIENT_URL in production
  • No secrets in code: All sensitive values via environment variables
  • GPS anti-fraud: Server-side radius validation (not client-trusting)
  • Certificate fraud prevention: Unique IDs + org approval required

πŸ“ˆ Scalability Recommendations

Database Indexes (already configured)

  • User.email (unique)
  • Application.volunteerId + opportunityId (compound unique)
  • Certificate.verificationCode (unique)
  • Opportunity.category, organizationId, geolocation

Horizontal Scaling

  • Backend is stateless (JWT) β€” run N replicas behind a load balancer
  • Use MongoDB Atlas for managed horizontal scaling
  • Add Redis for caching AI match scores (expensive computation)

AI Matching in Production

// Replace generateEmbedding() in matchingAlgorithm.js:
const { OpenAI } = require('openai');
const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });

const generateEmbedding = async (text) => {
  const res = await client.embeddings.create({ model: 'text-embedding-3-small', input: text });
  return res.data[0].embedding;
};

Production Checklist

  • Set NODE_ENV=production
  • Use a strong JWT_SECRET (32+ random chars)
  • Enable MongoDB Atlas TLS
  • Set CLIENT_URL to your actual domain
  • Configure HTTPS (via nginx or cloud provider)
  • Set up log aggregation (e.g., Winston + CloudWatch)
  • Add rate limiting (express-rate-limit)
  • Configure automated MongoDB backups
  • Set up monitoring (PM2 or a cloud service)

πŸ§ͺ Sample API Requests

Register as Volunteer

curl -X POST http://localhost:5000/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Jane Smith",
    "email": "jane@example.com",
    "password": "securepass",
    "role": "volunteer",
    "skills": ["Python", "Teaching"],
    "interests": ["education", "technology"]
  }'

Get AI-Ranked Opportunities

curl http://localhost:5000/api/matching/opportunities \
  -H "Authorization: Bearer <your_token>"

Verify Certificate (Public)

curl http://localhost:5000/api/certificates/verify/ABCD1234EF56

πŸ—“ Roadmap

  • Real OpenAI/HuggingFace embeddings for semantic matching
  • In-app messaging between volunteers and organizations
  • Admin dashboard
  • Email notifications (nodemailer/SendGrid)
  • Mobile app (React Native)
  • Blockchain certificate anchoring
  • Impact analytics dashboard

About

Full-stack MERN application connecting volunteers, organizations, and mentors through opportunity matching, mentorship, attendance tracking, and certificate management.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages