Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DKSingh1604/Saath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CommuteTogether Logo

Saath - a Community Car Pool App

A modern carpooling application where users choose their role (driver or passenger) for each individual trip, rather than having a fixed role during registration.

πŸš€ Quick Start

Backend Setup

cd backend
npm install
cp .env.example .env  # Configure your environment variables
npm run dev

Flutter App Setup

flutter pub get
flutter run

πŸ—οΈ Architecture Overview

Per-Ride Role Selection

  • βœ… 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

Key Features

  • πŸ” 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

πŸ“ Project Structure

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

πŸ”§ API Endpoints

Authentication

  • POST /api/auth/register - Minimal user registration
  • POST /api/auth/login - User login
  • POST /api/auth/verify-email - Email verification
  • POST /api/auth/resend-otp - Resend verification code

Rides

  • POST /api/rides - Create ride (driver role, includes vehicle info)
  • GET /api/rides - Search available rides
  • POST /api/rides/:id/book - Book ride (passenger role)
  • GET /api/rides/:id - Get ride details

Users

  • GET /api/auth/me - Get current user profile
  • PUT /api/auth/me - Update user profile

πŸ§ͺ Testing

Backend Tests

cd backend
npm test                    # Run all tests
npm run test:watch         # Watch mode

Test Coverage

  • βœ… 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 Tests

flutter test

πŸ” Environment Variables

Backend (.env)

NODE_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

πŸš€ Deployment

Backend (Node.js)

  • Deploy to Heroku, Railway, or similar
  • Set environment variables
  • Ensure MongoDB Atlas connection

Flutter App

  • Build for iOS: flutter build ios
  • Build for Android: flutter build apk
  • Deploy to App Store / Play Store

🎯 Key Benefits

User Experience

  • 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

Technical

  • 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

Business

  • Higher conversion: Simpler registration increases signups
  • Increased engagement: Users participate in multiple ways
  • Better retention: Not limited by initial role selection

πŸ”„ Migration from Fixed-Role Systems

If migrating from a system with fixed driver/passenger roles:

  1. Database: Remove isDriver, vehicle, preferences from user schema
  2. Registration: Update to collect only essential fields
  3. UI Flow: Replace role-based navigation with per-ride selection
  4. API: Update ride creation to accept vehicle info in request
  5. Testing: Ensure users can switch between roles seamlessly

πŸ“– Documentation

  • Per-Ride Roles System - Detailed technical documentation
  • API Documentation - Complete API reference (coming soon)
  • Deployment Guide - Production deployment steps (coming soon)

🀝 Contributing

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

πŸ“„ License

This project is licensed under the MIT License.


Built with ❀️ for flexible, user-friendly carpooling

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published