CarPool is a scalable, full-stack ride-sharing platform that connects drivers and passengers for optimized carpooling. The project is designed to reduce traffic congestion, carbon emissions, and daily commute costs by encouraging shared rides. It integrates real-time chat, wallet-based payments, secure authentication, and geolocation services to deliver a seamless user experience.
- Frontend: Tailwind CSS, React.js, Vite
- Backend: Node.js, Express.js
- Database: MongoDB with Mongoose ODM
- Authentication: Firebase Auth (Email & Google)
- Real-Time Features: Socket.IO
- Geolocation: Google Maps JavaScript & Places API
- Payments: Razorpay
- Containerization: Docker & Docker Compose
- Deployment: Vercel (Frontend), Render (Backend), MongoDB Atlas
-
🔍 Destination-Based Ride Matching
Users can search for available rides by destination using Google Maps Autocomplete for precise queries. -
🗺️ Google Maps API Integration
Displays map previews, captures geo-coordinates, and suggests verified locations using Google Places. -
💬 Real-Time Chat
Enables secure in-app communication between drivers and passengers via Socket.IO. -
💳 Wallet-Based Payment System
Users can add funds, split fares, and pay securely using Razorpay. -
🔐 Authentication & Authorization
Secure login with Google or Email/Password using Firebase Authentication. -
🛠️ Admin Panel (Coming Soon)
Role-based controls to manage ride listings, user reports, and payments.
- Autocomplete used for source/destination input.
- Prevents user errors (e.g., typos or invalid locations).
- Only allows verified locations into the database for precise querying.
The easiest way to run the entire application is using Docker and Docker Compose.
- Docker installed on your system
- Docker Compose installed on your system
- Clone the repository
git clone https://github.com/RISHABHKUSHWAHA7/CarPool.git
cd CarPool- Create environment file
cp .env.example .env-
Configure environment variables
Edit the.envfile and add your API keys and secrets:- MongoDB credentials
- JWT secret
- Google Maps API key
- Firebase configuration
- Razorpay credentials
-
Build and run with Docker Compose
docker-compose up --build- Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- MongoDB: localhost:27017
# Start all services
docker-compose up
# Start services in detached mode (background)
docker-compose up -d
# Stop all services
docker-compose down
# View logs
docker-compose logs -f
# View logs for specific service
docker-compose logs -f server
docker-compose logs -f client
# Rebuild containers
docker-compose up --build
# Stop and remove all containers, networks, and volumes
docker-compose down -vThe Docker setup includes three services:
- MongoDB - Database service running on port 27017
- Server - Node.js/Express backend running on port 8000
- Client - React/Vite frontend served by Nginx on port 3000
If you prefer to run the application without Docker:
- Node.js (v18 or higher)
- MongoDB (local or Atlas)
- npm or yarn
# Navigate to server directory
cd server
# Install dependencies
npm install
# Create .env file in server directory
# Add the following environment variables:
PORT=8000
MONGO_DB_URL=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
RESET_TOKEN_SECRET=your_reset_token_secret
FRONTEND_URL=http://localhost:3000
RAZORPAY_KEY_ID=your_razorpay_key_id
RAZORPAY_KEY_SECRET=your_razorpay_key_secret
CORS_ORIGIN=*
# Start the server
npm run dev # Development mode
npm start # Production mode# Navigate to client directory
cd client
# Install dependencies
npm install
# Create .env file in client directory
# Add the following environment variables:
VITE_BACKEND_URL=http://localhost:8000
VITE_GOOGLE_MAP_API=your_google_maps_api_key
VITE_FIREBASE_API_KEY=your_firebase_api_key
VITE_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your_project_id
VITE_FIREBASE_STORAGE_BUCKET=your_project.firebasestorage.app
VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
VITE_FIREBASE_APP_ID=your_app_id
VITE_FIREBASE_MEASUREMENT_ID=your_measurement_id
VITE_RAZORPAY_KEY_ID=your_razorpay_key_id
# Start the development server
npm run dev
# Build for production
npm run buildSee .env.example file for a complete list of required environment variables.
PORT- Server port (default: 8000)MONGO_DB_URL- MongoDB connection stringJWT_SECRET- Secret key for JWT tokensRESET_TOKEN_SECRET- Secret key for password reset tokensFRONTEND_URL- Frontend application URLRAZORPAY_KEY_ID- Razorpay API keyRAZORPAY_KEY_SECRET- Razorpay secret keyCORS_ORIGIN- CORS origin configuration
VITE_BACKEND_URL- Backend API URLVITE_GOOGLE_MAP_API- Google Maps API keyVITE_FIREBASE_*- Firebase configurationVITE_RAZORPAY_KEY_ID- Razorpay public key
CarPool/
├── client/ # React frontend
│ ├── public/ # Static assets
│ ├── src/
│ │ ├── components/ # Reusable components
│ │ ├── context/ # React context providers
│ │ ├── hooks/ # Custom React hooks
│ │ ├── pages/ # Page components
│ │ ├── assets/ # Images and media
│ │ └── App.jsx # Main App component
│ ├── Dockerfile # Client Docker configuration
│ └── package.json
│
├── server/ # Node.js backend
│ ├── src/
│ │ ├── controllers/ # Route controllers
│ │ ├── models/ # MongoDB models
│ │ ├── routes/ # API routes
│ │ ├── middleware/ # Custom middleware
│ │ ├── socket/ # Socket.IO configuration
│ │ ├── databases/ # Database connection
│ │ └── server.js # Entry point
│ ├── Dockerfile # Server Docker configuration
│ └── package.json
│
├── screenshots/ # Application screenshots
├── docker-compose.yml # Docker orchestration
├── .env.example # Environment variables template
└── README.md # Project documentation
POST /api/auth/signup- Register new userPOST /api/auth/signin- User loginPOST /api/auth/signout- User logout
GET /api/trip- Get all tripsPOST /api/trip- Create new tripGET /api/trip/:id- Get trip detailsPUT /api/trip/:id- Update tripDELETE /api/trip/:id- Delete trip
GET /api/booking- Get user bookingsPOST /api/booking- Create new bookingGET /api/booking/:id- Get booking detailsPUT /api/booking/:id- Update booking status
GET /api/user/profile- Get user profilePUT /api/user/profile- Update user profileGET /api/user/:id- Get user by ID
POST /api/payment/create-order- Create Razorpay orderPOST /api/payment/verify- Verify payment
GET /api/message/:conversationId- Get messagesPOST /api/message- Send message
GET /api/notifications- Get user notificationsPUT /api/notifications/:id- Mark as read
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License.
Rishabh Kushwaha
- GitHub: @RISHABHKUSHWAHA7
- Google Maps API for location services
- Firebase for authentication
- Razorpay for payment processing
- Socket.IO for real-time features
- MongoDB Atlas for database hosting
For any queries or support, please reach out:
- Create an issue in this repository
For production deployment with Docker:
# Build optimized images
docker-compose build
# Run in production mode
docker-compose up -d- Frontend: Deploy to Vercel, Netlify, or any static hosting
- Backend: Deploy to Render, Railway, or AWS EC2
- Database: Use MongoDB Atlas for managed database
- Frontend: https://car-pool-one.vercel.app
- Backend: https://carpool-xdk9.onrender.com
Happy Carpooling! 🚗💨