RideMates is a full-stack ride-sharing application that connects drivers with passengers. It facilitates ride creation, booking, and real-time communication between users.
- User Authentication: Secure signup and signin using JWT and Google Authentication.
- Ride Management:
- Create rides with details like source, destination, date, time, and price.
- Search and book available rides.
- Manage booking requests (accept/reject).
- Real-time Chat: Integrated chat functionality using Socket.io for communication between drivers and passengers.
- Dashboard: View created rides, booked rides, and manage passengers.
- Responsive Design: Built with React and Tailwind CSS for a seamless mobile and desktop experience.
- React: UI library.
- Vite: Build tool and development server.
- Tailwind CSS: Utility-first CSS framework.
- React Router: Client-side routing.
- Socket.io Client: Real-time bidirectional event-based communication.
- Axios: Promise based HTTP client.
- Node.js & Express: Server-side runtime and framework.
- MongoDB & Mongoose: NoSQL database and object modeling.
- Socket.io: Real-time engine.
- JWT: JSON Web Tokens for authentication.
- Zod: Schema validation.
- Node.js (v14 or higher)
- MongoDB (Local or Atlas)
This section provides a detailed overview of the project's folder structure and the purpose of key files.
The backend is built with Node.js, Express, and MongoDB.
backend/
├── controllers/ # Logic for handling API requests
├── middlewares/ # Custom middleware (e.g., auth checks)
├── models/ # Mongoose schemas for database collections
│ ├── Message.js # Chat message schema
│ ├── Reservation.js # Ride booking reservation schema
│ ├── Ride.js # Ride details schema
│ └── User.js # User profile and auth schema
├── routes/ # API route definitions
│ ├── chat.js # Chat-related routes
│ ├── reservation.js # Booking management routes
│ ├── rides.js # Ride creation and retrieval routes
│ └── user.js # Authentication routes
├── database.js # MongoDB connection setup
├── index.js # Application entry point (Server & Socket.io setup)
└── .env # Environment variables (PORT, MONGO_URL, etc.)
The frontend is a React application built with Vite and Tailwind CSS.
frontend/
├── public/ # Static assets
├── src/
│ ├── components/ # Reusable React components and pages
│ │ ├── BookRide.jsx # Page to search and book rides
│ │ ├── Chat.jsx # Real-time chat interface
│ │ ├── CreateRide.jsx # Form to publish a new ride
│ │ ├── FooterNav.jsx # Mobile-responsive navigation bar
│ │ ├── GoogleSignInButton.jsx # Google Auth component
│ │ ├── Inbox.jsx # List of active chat conversations
│ │ ├── ManageRequests.jsx # Driver's view to accept/reject bookings
│ │ ├── MyBookings.jsx # List of rides booked by the user
│ │ ├── MyCreated.jsx # List of rides created by the user
│ │ ├── Signin.jsx # User login page
│ │ ├── Signup.jsx # User registration page
│ │ └── ViewPassengers.jsx # View passenger details for a ride
│ ├── App.jsx # Main application component with Routing
│ ├── index.css # Global styles and Tailwind directives
│ └── main.jsx # React DOM entry point
├── index.html # HTML template
├── package.json # Dependencies and scripts
└── vite.config.js # Vite configuration
git clone <repository-url>
cd RideMatesNavigate to the backend directory:
cd backendInstall dependencies:
npm installCreate a .env file in the backend directory with the following variables:
PORT=3000
MONGO_URL=mongodb://localhost:27017/ridemates
JWT_SECRET=your_jwt_secret_key
FRONT_END=http://localhost:5173Start the backend server:
npm start
# OR for development with nodemon
npm run devThe server will start on http://localhost:3000.
Navigate to the frontend directory:
cd ../frontendInstall dependencies:
npm installStart the development server:
npm run devThe application will be available at http://localhost:5173.
POST /users/signup: Register a new user.POST /users/signin: Authenticate a user.
POST /rides/create: Create a new ride.GET /rides/all: Get all available rides.GET /rides/my-created-rides: Get rides created by the logged-in user.GET /rides/my-booked-rides: Get rides booked by the logged-in user.
POST /reserve/book: Book a ride.POST /reserve/accept: Accept a booking request.POST /reserve/reject: Reject a booking request.
- Real-time messaging via Socket.io events (
chat:join,chat:send,chat:message).
This project is licensed under the ISC License.