Skip to content

anushkamohan18/RideSafe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

RideSafe - Women-Centric Safe Ride Sharing Web Application

Version License Build Status

๐Ÿš— Overview

RideSafe is a comprehensive women-centric web-based ride-sharing application designed with safety and security as the top priority. Built specifically for women travelers, it provides a secure platform for ride booking with advanced safety features, customizable gender preferences, real-time tracking, and comprehensive privacy controls. Our mission is to make transportation safer and more comfortable for women everywhere.

โœจ Current Implementation Status: PRODUCTION READY

๐ŸŽฏ Core Features Implemented

๐Ÿ” Authentication & Security

  • โœ… Complete Auth System: Registration, login, JWT with refresh tokens
  • โœ… Role-based Access: Passenger, Driver, Admin roles with proper middleware
  • โœ… Password Security: Bcrypt hashing, secure password policies
  • โœ… Protected Routes: Client-side route protection with role validation

๐Ÿ  User Interface

  • โœ… Modern React App: React 18 with Material-UI design system
  • โœ… Responsive Design: Mobile-first, works on all device sizes
  • โœ… Dark/Light Theme: Comprehensive theming with user preference storage
  • โœ… PWA Support: Service worker, manifest, offline capabilities
  • โœ… Navigation: Bottom navigation for mobile, sidebar for desktop

๐Ÿ›ก๏ธ Advanced Women-Centric Settings & Privacy

  • โœ… Comprehensive Settings Page: 50+ configurable options tailored for women's safety
  • โœ… Privacy Controls: Hide real name, mask phone, ride history lock for enhanced privacy
  • โœ… Gender Preference Options: Customizable driver gender preferences with time-based settings
  • โœ… Gender-Based Safety Preferences: Female driver preferences, women-only rides
  • โœ… Enhanced Driver Verification: Stricter verification requirements for women's safety
  • โœ… Emergency Contacts: Trusted contacts with live location sharing for family peace of mind
  • โœ… Audio Recording: Emergency audio recording capabilities for safety documentation
  • โœ… Appearance Settings: Font size, theme, accessibility options

๐Ÿ—บ๏ธ Maps & Location

  • โœ… Free Map Integration: OpenStreetMap with Leaflet (no API keys required)
  • โœ… Location Services: GPS tracking, geocoding, route planning
  • โœ… Real-time Tracking: Live location updates during rides
  • โœ… Geofencing: Pickup/dropoff zone validation

๐Ÿš€ Backend Infrastructure

  • โœ… RESTful API: Complete Express.js API with proper error handling
  • โœ… Database: PostgreSQL with Prisma ORM, full schema implemented
  • โœ… Real-time Features: Socket.io for live updates and messaging
  • โœ… Security Middleware: Helmet, CORS, rate limiting, input validation
  • โœ… Production Ready: Logging, health checks, error boundaries

๐Ÿ”ง Development Experience

  • โœ… Unified Scripts: Single command to start both frontend and backend
  • โœ… Hot Reload: Frontend and backend auto-restart on changes
  • โœ… Environment Management: Separate configs for dev/staging/production
  • โœ… Error Handling: Comprehensive error boundaries and logging
  • โœ… Code Quality: ESLint, consistent formatting, proper TypeScript types

๐Ÿ—๏ธ Project Architecture

RideSafe/
โ”œโ”€โ”€ ๐Ÿ“ฑ Frontend (React 18 Web App)
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ pages/              # Main application pages
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ LoginPage.js
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ RegisterPage.js
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ HomePage.js
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ BookRidePage.js
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ SettingsPage.js  # Comprehensive settings
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”‚   โ”œโ”€โ”€ components/         # Reusable UI components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Navigation.js
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ErrorBoundary.js
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ProtectedRoute.js
โ”‚   โ”‚   โ”œโ”€โ”€ context/           # React contexts
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ AuthContext.js
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ SocketContext.js
โ”‚   โ”‚   โ”œโ”€โ”€ services/          # API services
โ”‚   โ”‚   โ”œโ”€โ”€ config/            # Configuration
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ env.js         # Environment config
โ”‚   โ”‚   โ””โ”€โ”€ styles/            # Global styles
โ”‚   โ”œโ”€โ”€ public/                # Static assets
โ”‚   โ”‚   โ””โ”€โ”€ manifest.json      # PWA manifest
โ”‚   โ”œโ”€โ”€ App.js                 # Main app with theming
โ”‚   โ””โ”€โ”€ package.json           # Dependencies & scripts
โ”‚
โ”œโ”€โ”€ ๐Ÿ”ง Backend (Node.js/Express)
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ routes/            # API routes
โ”‚   โ”‚   โ”œโ”€โ”€ middleware/        # Auth & validation
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ auth.js        # JWT authentication
โ”‚   โ”‚   โ”œโ”€โ”€ services/          # Business logic
โ”‚   โ”‚   โ””โ”€โ”€ models/            # Database models
โ”‚   โ”œโ”€โ”€ prisma/
โ”‚   โ”‚   โ””โ”€โ”€ schema.prisma      # Database schema
โ”‚   โ”œโ”€โ”€ server.js              # Server entry point
โ”‚   โ””โ”€โ”€ package.json           # Backend dependencies
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‹ Configuration & Scripts
โ”‚   โ”œโ”€โ”€ UNIFIED_SCRIPTS_GUIDE.md  # Development workflow guide
โ”‚   โ”œโ”€โ”€ package.json              # Unified scripts
โ”‚   โ””โ”€โ”€ .env.example              # Environment template
โ”‚
โ””โ”€โ”€ ๐Ÿ“š Documentation
    โ””โ”€โ”€ README.md                 # This file

๐Ÿš€ Quick Start (60 seconds setup)

Prerequisites

  • Node.js: v18.0.0+ (Download)
  • PostgreSQL: v13.0+ (Download)
  • Git: Latest version

1. Clone & Setup

# Clone repository
git clone <your-repository-url>
cd RideSafe

# Install all dependencies (frontend + backend)
npm run setup

2. Environment Configuration

# Copy environment template
cp .env.example .env

# Edit .env file with your database credentials
# Minimum required:
DATABASE_URL="postgresql://username:password@localhost:5432/ridesafe"
JWT_SECRET="your-super-secret-jwt-key-here"

3. Database Setup

# Setup database and run migrations
npm run backend:setup-db

# Seed with test data (optional)
npm run seed

4. Start Development

# Start both frontend and backend
npm start

That's it! ๐ŸŽ‰

๐Ÿ“‹ Test Credentials

After seeding, you can login with:

Riders:

  • Email: rider1@example.com / Password: password123
  • Email: rider2@example.com / Password: password123

Drivers:

  • Email: driver1@example.com / Password: password123
  • Email: driver2@example.com / Password: password123

๐Ÿ› ๏ธ Available Scripts

๐Ÿ”ฅ Main Development Scripts

npm start                    # Start both frontend & backend
npm run dev                  # Same as npm start
npm run start:production     # Start in production mode

๐ŸŽฏ Frontend Scripts

npm run frontend:start       # Start only React frontend
npm run frontend:build       # Build for production
npm run frontend:test        # Run frontend tests
npm run frontend:lint        # Check code quality

โš™๏ธ Backend Scripts

npm run backend:start        # Start backend (production)
npm run backend:dev          # Start backend (development)
npm run backend:setup-db     # Setup database & migrations
npm run backend:seed         # Seed with test data
npm run backend:test         # Run backend tests

๐Ÿ› ๏ธ Utility Scripts

npm run setup               # Install all dependencies
npm run build              # Build frontend
npm run test              # Run all tests
npm run lint              # Lint all code

๐Ÿ”ง Environment Configuration

Required Environment Variables

Create .env in project root:

# Database (Required)
DATABASE_URL="postgresql://username:password@localhost:5432/ridesafe"

# JWT Secrets (Required)
JWT_SECRET="your-super-secret-jwt-key-minimum-32-characters"
JWT_REFRESH_SECRET="your-refresh-token-secret-different-from-jwt"

# API Configuration
REACT_APP_API_URL="http://localhost:8000/api"
REACT_APP_SOCKET_URL="http://localhost:8000"

# Optional: External Services
TWILIO_ACCOUNT_SID="your_twilio_sid"
TWILIO_AUTH_TOKEN="your_twilio_token"
SMTP_HOST="smtp.gmail.com"
SMTP_USER="your_email@gmail.com"
SMTP_PASS="your_app_password"

# Optional: Monitoring
REACT_APP_SENTRY_DSN="your_sentry_dsn"
REACT_APP_GOOGLE_ANALYTICS_ID="your_ga_id"

Backend Environment Variables

Create backend/.env:

# Database
DATABASE_URL="postgresql://username:password@localhost:5432/ridesafe"

# Security
JWT_SECRET="your-super-secret-jwt-key-minimum-32-characters"
JWT_REFRESH_SECRET="your-refresh-token-secret"
BCRYPT_ROUNDS=12

# Server Configuration
PORT=8000
NODE_ENV=development
FRONTEND_URL="http://localhost:3000"

# External Services (Optional)
TWILIO_ACCOUNT_SID="your_twilio_sid"
TWILIO_AUTH_TOKEN="your_twilio_token"
SMTP_HOST="smtp.gmail.com"
SMTP_PORT=587
SMTP_USER="your_email@gmail.com"
SMTP_PASS="your_app_password"

๐Ÿ—บ๏ธ Maps Integration (No API Key Required!)

RideSafe uses OpenStreetMap with Leaflet - completely free with no API keys needed:

  • โœ… Free Forever: No billing, no quotas, no API keys
  • โœ… Full Featured: Geocoding, routing, search, tiles
  • โœ… Privacy Focused: No tracking, no data collection
  • โœ… Open Source: Community-driven mapping data

The maps work out of the box with no additional configuration required.

๐Ÿ›ก๏ธ Women-Centric Safety & Privacy Features

๐Ÿ”’ Enhanced Privacy Controls for Women

  • Hide Real Name: Use initials or display name only for anonymity
  • Mask Phone Number: VoIP calling for complete privacy protection
  • Ride History Lock: Biometric/PIN protection for past rides
  • Location Control: Granular location sharing preferences with family override

๐Ÿ‘ฅ Flexible Gender Preference Options

  • Customizable Gender Preferences: Choose preferred driver gender (Male/Female/No Preference)
  • Time-Based Gender Settings: Different preferences for day rides vs. night rides
  • Female Driver Priority: Prefer female drivers for added comfort and safety
  • Women-Only Rides: Option to exclusively ride with verified female drivers
  • Mixed Gender Settings: Flexible options for users comfortable with any gender
  • Emergency Override: Allow any gender driver during emergency situations
  • Family Mode: Special settings when traveling with family members

๐Ÿ†˜ Women-Focused Emergency Features

  • SOS Button: One-tap emergency alerts with location sharing
  • Trusted Contacts: Auto-notify selected family/friends during rides
  • Live Location Sharing: Real-time location sharing with trusted contacts
  • Audio Recording: Emergency audio recording for safety documentation
  • Women's Helpline Integration: Quick access to women's safety helplines
  • Safe Word System: Discreet emergency communication system

๐Ÿ›ก๏ธ Enhanced Security for Women

  • Identity Verification: Stricter verification for all users regardless of gender
  • Background Checks: Enhanced screening for all drivers
  • Gender-Verified Drivers: Special verification process for female drivers
  • Real-time Monitoring: AI-powered ride monitoring for unusual patterns
  • Safe Route Planning: Prefer well-lit, populated routes
  • Driver Ratings by Women: Separate safety ratings from female passengers

๐ŸŽจ Theming & Accessibility

Theme Features

  • Dark/Light Mode: Full theme switching with persistence
  • Font Size Control: 4 levels (Small, Medium, Large, XL)
  • High Contrast: Enhanced visibility options
  • Color Customization: Material-UI theming system

Accessibility

  • Screen Reader Support: ARIA labels and semantic HTML
  • Keyboard Navigation: Full keyboard accessibility
  • Focus Management: Proper focus indicators
  • Color Blind Friendly: Sufficient color contrast ratios

๐Ÿƒโ€โ™‚๏ธ Development Workflow

Daily Development

# Start everything
npm start

# Make changes to frontend or backend
# Changes auto-reload with hot reload

Code Quality

# Check code quality
npm run lint

# Fix linting issues
npm run frontend:lint:fix

# Run tests
npm test

Database Changes

# Create new migration
cd backend
npx prisma migrate dev --name your_migration_name

# Reset database (development only)
npx prisma migrate reset

๐Ÿšข Production Deployment

Build for Production

# Build optimized frontend
npm run build

# Start backend in production mode
npm run backend:start

Environment Setup

# Production environment
cp .env.production .env

# Set production variables
NODE_ENV=production
REACT_APP_ENV=production

Database Migration

# Run migrations in production
cd backend
npx prisma migrate deploy

๐Ÿ“Š Database Schema

Core Models

  • User: Authentication, profile, preferences
  • Ride: Booking, tracking, history
  • Vehicle: Driver vehicle information
  • RideRating: User ratings and reviews
  • EmergencyReport: Safety incidents
  • Message: In-app communication

Key Relationships

  • Users can be both riders and drivers
  • Rides connect riders with drivers
  • Ratings are bidirectional (rider โ†” driver)
  • Emergency reports track safety incidents
  • Messages enable real-time communication

๐Ÿ” Testing

Manual Testing Checklist

  • User registration and login
  • Password reset functionality
  • Theme switching (dark/light)
  • Settings page functionality
  • Maps and location services
  • Ride booking flow
  • Emergency features
  • Mobile responsiveness

Automated Testing

# Run all tests
npm test

# Frontend tests only
npm run frontend:test

# Backend tests only
npm run backend:test

๐Ÿ› Troubleshooting

Common Issues

Database Connection Error

# Check PostgreSQL is running
# On macOS: brew services start postgresql
# On Ubuntu: sudo systemctl start postgresql

# Verify DATABASE_URL in .env
# Create database if it doesn't exist
createdb ridesafe

Port Already in Use

# Kill processes on ports 3000 or 8000
npx kill-port 3000
npx kill-port 8000

Module Not Found Errors

# Reinstall dependencies
npm run setup

Maps Not Loading

  • OpenStreetMap requires no API keys
  • Check internet connection
  • Verify browser supports geolocation API

๐Ÿ“ˆ Performance Features

Frontend Optimizations

  • Code Splitting: Dynamic imports for pages
  • Lazy Loading: Images and components
  • Service Worker: Caching and offline support
  • Bundle Analysis: Optimized build sizes
  • React 18: Concurrent features and suspense

Backend Optimizations

  • Database Indexing: Optimized queries
  • Connection Pooling: Efficient database connections
  • Response Compression: Gzip compression
  • Rate Limiting: Prevent server overload
  • Request Validation: Input sanitization

๐Ÿ”„ Real-time Features

Socket.io Integration

  • Live Ride Tracking: Real-time location updates
  • Instant Messaging: Rider-driver communication
  • Status Updates: Ride status changes
  • Emergency Alerts: Immediate safety notifications

Connection Management

  • Auto-reconnection: Handles network interruptions
  • Graceful Degradation: Works without sockets
  • Error Recovery: Robust error handling

๐Ÿ“ฑ Progressive Web App (PWA)

PWA Features

  • Installable: Add to home screen
  • Offline Support: Basic functionality without internet
  • Push Notifications: Web notifications support
  • App-like Experience: Native app feel

Manifest Configuration

  • Icons: Multiple sizes for different devices
  • Theme Colors: Matches app branding
  • Display Mode: Standalone app experience
  • Shortcuts: Quick actions from home screen

๐Ÿค Contributing

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/amazing-feature
  3. Follow the existing code style
  4. Add tests for new features
  5. Update documentation as needed
  6. Commit changes: git commit -m 'Add amazing feature'
  7. Push to branch: git push origin feature/amazing-feature
  8. Open a Pull Request

Code Style

  • Use ESLint configuration provided
  • Follow Material-UI design patterns
  • Write descriptive commit messages
  • Add JSDoc comments for functions
  • Maintain consistent file structure

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ†˜ Support & Documentation

Getting Help

Additional Resources

  • API Documentation: Available at /api/docs when server is running
  • Database Schema: Check backend/prisma/schema.prisma
  • Environment Guide: See ENV_VARIABLES_NEEDED.txt

๐ŸŽฏ Project Status & Next Steps

โœ… Completed Features

  • Full authentication system with enhanced security for women
  • Comprehensive women-centric settings and privacy controls
  • Flexible gender preference system with customizable options
  • Gender-based driver preferences and matching algorithms
  • Time-based gender preference settings (day/night)
  • Real-time ride tracking with family sharing capabilities
  • Free maps integration with safe route preferences
  • Mobile-responsive design optimized for women users
  • Production-ready backend with women's safety focus
  • Emergency features tailored for women's safety needs

๐Ÿ”ฎ Future Enhancements

  • Advanced Gender Matching: AI-powered gender preference learning
  • Gender Preference Analytics: Insights into user preference patterns
  • Women's Community Features: Driver and rider community forums
  • Safety Ratings by Gender: Detailed safety analytics by female users
  • Partnership with Women's Organizations: Integration with women's safety groups
  • Advanced AI Safety Monitoring: Machine learning for threat detection
  • Women's Safety Training: Safety tips and training modules
  • Female Driver Incentives: Special programs to encourage female drivers
  • Safe Space Verification: Verified safe pickup/drop-off locations
  • Women's Ride Groups: Group ride features with gender preferences

Ready to ride safely - designed by women, for women, with complete control over your gender preferences! ๐Ÿ›ก๏ธ๐Ÿš—๐Ÿ‘ฉ

About

RideSafe is an innovative project aimed at enhancing road safety, with a special focus on providing secure cab booking options for women. The platform allows users to select gender preference when booking rides, helping ensure a safer and more comfortable travel experience for women.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages