A modern carpooling application where users choose their role (driver or passenger) for each individual trip, rather than having a fixed role during registration.
cd backend
npm install
cp .env.example .env # Configure your environment variables
npm run devflutter pub get
flutter run- β Home Screen: Users choose "Offer a Ride" (driver) or "Find a Ride" (passenger) for each trip
- β Minimal Registration: Only essential fields (name, email, phone, city, password)
- β Flexible Usage: Same user can be driver today, passenger tomorrow
- β Per-Ride Vehicle Info: Vehicle details provided when creating ride, not stored in user profile
- π JWT Authentication with email verification
- π§ Mailgun Integration for transactional emails
- πΊοΈ Location-Based Matching with coordinates
- π° Dynamic Pricing per seat
- π¬ Real-Time Chat for ride coordination
- β Rating System for drivers and passengers
- π Comprehensive Validation and security
car_pool_app/
βββ backend/ # Node.js Express API
β βββ models/ # MongoDB schemas
β β βββ User.js # User model (minimal, no driver fields)
β β βββ Ride.js # Ride model with per-ride vehicle info
β β βββ Chat.js # Chat/messaging
β βββ routes/ # API endpoints
β β βββ auth.js # Authentication (minimal registration)
β β βββ rides.js # Ride creation & booking
β β βββ users.js # User management
β βββ middleware/ # Auth, validation, error handling
β βββ utils/ # Mailgun, helpers
β βββ tests/ # Test suites
β βββ scripts/ # Dev utilities
βββ lib/ # Flutter app
β βββ screens/ # UI screens
β β βββ home_screen.dart # Role selection home
β β βββ auth/ # Authentication flows
β β β βββ register_screen.dart # Minimal registration
β β β βββ login_screen.dart # Login
β β βββ rides/ # Ride management
β β βββ post_ride_screen.dart # Create ride (driver)
β β βββ find_rides_screen.dart # Search rides (passenger)
β βββ models/ # Data models
β βββ services/ # API services
β βββ widgets/ # Reusable components
βββ docs/ # Documentation
βββ PER_RIDE_ROLES.md # Detailed system documentation
POST /api/auth/register- Minimal user registrationPOST /api/auth/login- User loginPOST /api/auth/verify-email- Email verificationPOST /api/auth/resend-otp- Resend verification code
POST /api/rides- Create ride (driver role, includes vehicle info)GET /api/rides- Search available ridesPOST /api/rides/:id/book- Book ride (passenger role)GET /api/rides/:id- Get ride details
GET /api/auth/me- Get current user profilePUT /api/auth/me- Update user profile
cd backend
npm test # Run all tests
npm run test:watch # Watch mode- β Ride creation with per-ride vehicle info
- β Passenger booking validation
- β Edge cases (own ride booking, insufficient seats, etc.)
- β Minimal registration flow
- β User role flexibility
flutter testNODE_ENV=development
PORT=5000
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
JWT_EXPIRE=7d
MAILGUN_API_KEY=your_mailgun_api_key
MAILGUN_DOMAIN=your_mailgun_domain- Deploy to Heroku, Railway, or similar
- Set environment variables
- Ensure MongoDB Atlas connection
- Build for iOS:
flutter build ios - Build for Android:
flutter build apk - Deploy to App Store / Play Store
- Simple onboarding: Quick registration without role commitment
- Real-world flexibility: Match actual carpooling usage patterns
- Lower barriers: No need to decide "am I a driver?" upfront
- Clean data model: No legacy driver fields in user profiles
- Better scalability: Per-ride context for vehicle/preferences
- Easier maintenance: Single user type, role chosen per action
- Higher conversion: Simpler registration increases signups
- Increased engagement: Users participate in multiple ways
- Better retention: Not limited by initial role selection
If migrating from a system with fixed driver/passenger roles:
- Database: Remove
isDriver,vehicle,preferencesfrom user schema - Registration: Update to collect only essential fields
- UI Flow: Replace role-based navigation with per-ride selection
- API: Update ride creation to accept vehicle info in request
- Testing: Ensure users can switch between roles seamlessly
- Per-Ride Roles System - Detailed technical documentation
- API Documentation - Complete API reference (coming soon)
- Deployment Guide - Production deployment steps (coming soon)
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
This project is licensed under the MIT License.
Built with β€οΈ for flexible, user-friendly carpooling