Simple and friendly, like a buddy for rides!
RideBuddy is a modern ride-sharing/carpooling web application that connects drivers with passengers. Built with React and powered by Firebase authentication, this platform makes sharing rides easy, affordable, and environmentally friendly.
Click the thumbnail above to watch the demo on YouTube.
- Demo Video
- Features
- Tech Stack
- Project Structure
- Getting Started
- Available Scripts
- API Integration
- Authentication
- State Management
- Routing
- Deployment
- Contributing
- License
- π Search & Browse Rides - Find available rides by start and end location
- π Publish Rides - Share your journey and offer seats to others
- π« Request Management - Create, accept, or reject ride requests
- π° Automatic Fare Calculation - Smart pricing based on distance and fuel efficiency
- πΊοΈ Interactive Maps - Visualize routes with Leaflet.js integration
- π€ User Profiles - View driver and passenger information
- π Secure Authentication - Email/password and Google OAuth support
- π± Responsive Design - Seamless experience across all devices
- π Real-time Updates - Auto-refreshing ride requests
- π¨ Modern UI - Clean interface with DaisyUI components
- β‘ Fast Performance - Optimized with Vite and React
- React 18.2 - Modern UI library with hooks
- Vite 5.0 - Next-generation frontend build tool
- React Router DOM 6.20 - Client-side routing
- TailwindCSS 3.3 - Utility-first CSS framework
- DaisyUI 4.4 - Component library (Retro theme)
- Lucide React - Beautiful icon set
- React Icons - Additional icon library
- Redux Toolkit 2.1 - State management
- RTK Query - Data fetching and caching
- React Redux 9.0 - React bindings for Redux
- Axios 1.6 - HTTP client
- Firebase 10.14 - Authentication and storage
- Supabase 2.39 - Database and backend services
- Leaflet 1.9 - Interactive maps
- Leaflet Routing Machine 3.2 - Route planning and visualization
- React Hook Form 7.54 - Performant form handling
- SweetAlert2 11.16 - Beautiful alerts and modals
- Swiper 11.2 - Touch-enabled carousel
- dotenv 16.3 - Environment variable management
RideBuddy_Frontend/
βββ public/ # Static assets
βββ src/
β βββ components/ # Reusable UI components
β β βββ Navbar.jsx # Navigation header
β β βββ Footer.jsx # Site footer
β β βββ Login.jsx # Login form
β β βββ Register.jsx # Registration form
β β βββ PublishRide.jsx # Ride publishing interface
β β βββ PublishForm.jsx # Ride form component
β β βββ Loading.jsx # Loading spinner
β β βββ NotFound.jsx # 404 page
β β
β βββ pages/ # Page components
β β βββ home/
β β β βββ Home.jsx # Landing page
β β β βββ Banner.jsx # Hero section
β β β βββ Help.jsx # Help section
β β βββ request/
β β β βββ RequestPage.jsx # Ride requests dashboard
β β β βββ RideRequestCard.jsx # Request card component
β β βββ user/
β β βββ SearchPage.jsx # Ride search interface
β β βββ Search.jsx # Search form
β β βββ Card.jsx # Ride card
β β βββ Drawer.jsx # Navigation drawer
β β
β βββ context/ # React Context providers
β β βββ AuthContext.jsx # Authentication context
β β
β βββ firebase/ # Firebase configuration
β β βββ firebase.config.js
β β
β βββ redux/ # Redux store and slices
β β βββ store.js # Store configuration
β β βββ features/
β β β βββ rides/ # Ride management
β β β βββ requests/ # Request management
β β
β βββ routers/ # Route definitions
β β βββ router.jsx # Main router config
β β βββ PrivateRoute.jsx # Protected route wrapper
β β
β βββ utils/ # Utility functions
β β βββ baseURL.js # API base URL
β β
β βββ App.jsx # Root component
β βββ main.jsx # Application entry point
β βββ App.css # App-specific styles
β βββ index.css # Global styles
β
βββ .gitignore # Git ignore rules
βββ eslint.config.js # ESLint configuration
βββ index.html # HTML template
βββ package.json # Dependencies and scripts
βββ postcss.config.js # PostCSS configuration
βββ tailwind.config.js # Tailwind configuration
βββ vite.config.js # Vite configuration
βββ README.md # This file
Before you begin, ensure you have the following installed:
- Node.js (v16 or higher)
- npm or yarn package manager
- Git for version control
-
Clone the repository
git clone https://github.com/jjf2009/RideBuddy_Forntend.git cd RideBuddy_Forntend -
Install dependencies
npm install
Create a .env file in the root directory with the following variables:
# Firebase Configuration
VITE_API_KEY=your_firebase_api_key
VITE_AUTH_DOMAIN=your_firebase_auth_domain
VITE_PROJECT_ID=your_firebase_project_id
VITE_STORAGE_BUCKET=your_firebase_storage_bucket
VITE_MESSAGING_SENDER_ID=your_messaging_sender_id
VITE_APP_ID=your_firebase_app_id
# Optional: Supabase Configuration
VITE_SUPABASE_URL=your_supabase_url
VITE_SUPABASE_ANON_KEY=your_supabase_anon_keyImportant Notes:
- Replace the placeholder values with your actual Firebase credentials
- Get Firebase credentials from Firebase Console
- Never commit the
.envfile to version control - The backend API URL is configured in
src/utils/baseURL.js
Development Mode (with hot reload)
npm run devThe app will be available at http://localhost:5173
Production Build
npm run buildPreview Production Build
npm run preview| Script | Description |
|---|---|
npm run dev |
Start development server with hot reload |
npm run build |
Build optimized production bundle |
npm run preview |
Preview production build locally |
npm run lint |
Run ESLint to check code quality |
RideBuddy Frontend connects to a backend API hosted on Render.
Backend Repository: RideBuddy Backend
Base URL: https://ridebuddy-backend.onrender.com
GET /rides- Fetch all available ridesGET /rides/:id- Fetch specific ride detailsPOST /rides- Create a new ridePUT /rides/:id- Update ride informationDELETE /rides/:id- Delete a ride
GET /requests- Fetch all ride requestsGET /requests/:id- Fetch specific requestPOST /requests- Create new ride requestPATCH /requests/:id- Update request status (accept/reject)
The app automatically calculates ride fares based on:
- Distance: Calculated using Leaflet Routing Machine
- Fuel Efficiency: 15 km/liter
- Petrol Price: βΉ96.62 per liter
- Per-Person Fare: Total cost divided by available seats
RideBuddy uses Firebase Authentication with the following features:
-
Email/Password Authentication
- User registration with name, email, password
- Secure login with Firebase
-
Google OAuth
- One-click sign-in with Google account
- Automatic profile creation
User Input β Firebase Auth β Auth Context β Protected Routes
The AuthContext provides:
currentUser- Currently logged-in user objectloading- Authentication loading stateregisterUser(email, password, name)- Register new userloginUser(email, password)- Login existing usersignInWithGoogle()- Google OAuth sign-inlogout()- Sign out user
Routes requiring authentication:
/search- Search and browse rides/publish- Publish new ride
Unauthenticated users are redirected to the login page.
RideBuddy uses Redux Toolkit with RTK Query for efficient state management and API caching.
{
ridesApi: {
queries: { /* Cached ride data */ },
mutations: { /* Ride CRUD operations */ }
},
rideRequestsApi: {
queries: { /* Cached request data */ },
mutations: { /* Request operations */ }
}
}Rides:
useFetchAllRidesQuery()- Get all ridesuseFetchRideByIdQuery(id)- Get ride by IDuseAddRideMutation()- Create new rideuseUpdateRideMutation()- Update rideuseDeleteRideMutation()- Delete ride
Requests:
useFetchAllRequestsQuery()- Get all requestsuseFetchRequestByIdQuery(id)- Get request by IDuseAddRideRequestMutation()- Create requestuseUpdateRequestStatusMutation()- Update status
- β Automatic caching and invalidation
- β Built-in loading and error states
- β Optimistic updates
- β Reduced boilerplate code
RideBuddy uses React Router v6 with the following routes:
| Route | Component | Access | Description |
|---|---|---|---|
/ |
Home | Public | Landing page with app overview |
/register |
Register | Public | User registration |
/login |
Login | Public | User login |
/search |
SearchPage | Private | Search and browse rides |
/publish |
PublishRide | Private | Publish new ride |
/requests |
RequestPage | Private | View ride requests |
* |
NotFound | Public | 404 error page |
- Public Routes: Accessible to all users
- Private Routes: Require authentication (enforced by
PrivateRoutecomponent) - Unauthenticated users attempting to access private routes are redirected to
/login
The application can be deployed on various platforms:
Recommended Platforms:
- Vercel - Optimized for React/Vite apps
- Netlify - Easy deployment with CI/CD
- GitHub Pages - Free hosting for static sites
-
Create production build
npm run build
This creates an optimized build in the
dist/directory. -
Important: The
postinstallscript automatically creates a404.htmlfor SPA routing:"postinstall": "npm run build && cp dist/index.html dist/404.html"
Ensure all environment variables are configured in your deployment platform:
- Firebase credentials
- Supabase keys (if used)
- Backend API URL
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Commit your changes
git commit -m 'Add some amazing feature' - Push to the branch
git push origin feature/amazing-feature
- Open a Pull Request
- Follow the existing code style
- Use ESLint for code quality
- Write meaningful commit messages
- Test your changes thoroughly
- Update documentation as needed
jjf2009
- GitHub: @jjf2009
- LinkedIn: Connect on LinkedIn
This project is open source and available under the MIT License.
- React Team - For the amazing React library
- Vite Team - For the blazing fast build tool
- Firebase - For authentication and storage services
- Leaflet - For interactive mapping capabilities
- DaisyUI - For beautiful UI components
If you encounter any issues or have questions:
- Open an issue on GitHub Issues
- Contact the developer via social media links in the footer
Built with β€οΈ using React and Vite
