Skip to content

Latest commit

Β 

History

36 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš— RideFront - College Ride Sharing Platform

A modern, full-stack ride-sharing application built specifically for college students to connect and share rides efficiently. Features real-time tracking, chat, secure authentication, and an intuitive user interface.

React TypeScript Vite Firebase Tailwind CSS

✨ Features

Core Features

  • πŸ” Secure Authentication - Firebase-based user authentication with role-based access
  • 🚘 Ride Management - Create, search, book, and manage rides
  • πŸ—ΊοΈ Real-time Maps - Interactive maps powered by Mapbox GL JS
  • πŸ“ Live Tracking - Real-time driver location tracking
  • πŸ’¬ In-Ride Chat - Direct messaging between drivers and passengers
  • πŸ”” Push Notifications - Firebase Cloud Messaging integration
  • ⭐ Reviews & Ratings - Rate and review drivers and passengers
  • πŸ“± Responsive Design - Mobile-first, works on all devices
  • πŸŒ“ Theme Support - Light, dark, and system theme options

Technical Highlights

  • ⚑ Fast Development - Vite for lightning-fast HMR
  • 🎯 Type Safety - Full TypeScript support with strict mode
  • 🎨 Modern UI - Tailwind CSS for beautiful, responsive interfaces
  • πŸ”„ State Management - Zustand for lightweight, efficient state
  • πŸ“¦ Code Splitting - Optimized bundle sizes with smart chunking
  • πŸ›‘οΈ Error Boundaries - Graceful error handling throughout the app
  • βœ… Environment Validation - Automatic validation of configuration
  • πŸ”§ Developer Tools - ESLint, Prettier, TypeScript for code quality

πŸ“‹ Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js (v18.0.0 or higher) - Download
  • npm (v9.0.0 or higher) or yarn (v1.22.0 or higher)
  • Git - Download

You'll also need accounts for:

  • Firebase - For authentication and real-time features
  • Mapbox - For maps and geocoding services

πŸš€ Quick Start

1. Clone the Repository

git clone https://github.com/yourusername/ridefront.git
cd ridefront

2. Install Dependencies

npm install
# or
yarn install

3. Configure Environment Variables

Copy the example environment file and update it with your credentials:

cp env.example .env

Edit .env and replace the placeholder values:

# Backend API URL
VITE_API_BASE_URL=http://localhost:8000

# Mapbox Token (Get from: https://account.mapbox.com/access-tokens/)
VITE_MAPBOX_TOKEN=your_actual_mapbox_token

# Firebase Configuration (Get from: https://console.firebase.google.com/)
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_FIREBASE_VAPID_KEY=your_vapid_key

4. Start the Development Server

npm run dev
# or
yarn dev

The application will open at http://localhost:3000

πŸ”§ Available Scripts

Script Description
npm run dev Start development server with hot reload
npm run build Build production-ready bundle
npm run preview Preview production build locally
npm run lint Run ESLint to check code quality
npm run lint:fix Auto-fix ESLint errors
npm run format Format code with Prettier
npm run format:check Check if code is properly formatted
npm run type-check Run TypeScript type checking
npm run validate Run all checks (types, lint, format)
npm run clean Remove build artifacts

πŸ“ Project Structure

ridefront/
β”œβ”€β”€ public/                  # Static assets
β”‚   β”œβ”€β”€ manifest.json       # PWA manifest
β”‚   └── icons/              # App icons
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ assets/             # Images, fonts, etc.
β”‚   β”œβ”€β”€ components/         # Reusable React components
β”‚   β”‚   β”œβ”€β”€ AuthGuard.tsx   # Route protection component
β”‚   β”‚   β”œβ”€β”€ ErrorBoundary.tsx # Error handling component
β”‚   β”‚   β”œβ”€β”€ LoadingSpinner.tsx
β”‚   β”‚   └── MapboxMap.tsx
β”‚   β”œβ”€β”€ hooks/              # Custom React hooks
β”‚   β”‚   └── useStore.ts     # Zustand store
β”‚   β”œβ”€β”€ pages/              # Page components
β”‚   β”‚   β”œβ”€β”€ HomePage.tsx
β”‚   β”‚   β”œβ”€β”€ LoginPage.tsx
β”‚   β”‚   β”œβ”€β”€ RideSearchPage.tsx
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ services/           # API and external services
β”‚   β”‚   β”œβ”€β”€ api.ts          # Backend API service
β”‚   β”‚   β”œβ”€β”€ auth.ts         # Authentication service
β”‚   β”‚   β”œβ”€β”€ firebase.ts     # Firebase configuration
β”‚   β”‚   └── location.ts     # Location services
β”‚   β”œβ”€β”€ types/              # TypeScript type definitions
β”‚   β”‚   └── index.ts
β”‚   β”œβ”€β”€ utils/              # Utility functions
β”‚   β”‚   β”œβ”€β”€ index.ts        # Common utilities
β”‚   β”‚   └── validateEnv.ts  # Environment validation
β”‚   β”œβ”€β”€ App.tsx             # Main app component
β”‚   β”œβ”€β”€ main.tsx            # Application entry point
β”‚   └── index.css           # Global styles
β”œβ”€β”€ .env.example            # Environment variables template
β”œβ”€β”€ .prettierrc             # Prettier configuration
β”œβ”€β”€ eslint.config.js        # ESLint configuration
β”œβ”€β”€ tailwind.config.js      # Tailwind CSS configuration
β”œβ”€β”€ tsconfig.json           # TypeScript configuration
β”œβ”€β”€ vite.config.ts          # Vite configuration
└── package.json            # Project dependencies

πŸ” Setting Up Firebase

  1. Go to Firebase Console
  2. Create a new project (or select existing)
  3. Enable Authentication with Email/Password
  4. Enable Firestore Database
  5. Enable Cloud Messaging for push notifications
  6. Get your configuration from Project Settings β†’ General
  7. Add the configuration to your .env file

πŸ—ΊοΈ Setting Up Mapbox

  1. Create account at Mapbox
  2. Go to Access Tokens
  3. Create a new token with these scopes:
    • styles:read
    • fonts:read
    • datasets:read
    • geocoding:read
    • directions:read
  4. Copy the token to your .env file

πŸ—οΈ Building for Production

# Build optimized production bundle
npm run build

# Preview production build locally
npm run preview

The production files will be in the dist/ directory, ready for deployment.

🚒 Deployment

Vercel (Recommended)

# Install Vercel CLI
npm install -g vercel

# Deploy
vercel

Or connect your GitHub repository to Vercel for automatic deployments.

Netlify

# Install Netlify CLI
npm install -g netlify-cli

# Build and deploy
npm run build
netlify deploy --prod --dir=dist

Environment Variables for Production

Make sure to set all environment variables in your hosting platform:

  • Vercel: Project Settings β†’ Environment Variables
  • Netlify: Site Settings β†’ Build & Deploy β†’ Environment

πŸ§ͺ Testing

# Run type checking
npm run type-check

# Run linting
npm run lint

# Check formatting
npm run format:check

# Run all validations
npm run validate

🎨 Code Style

This project uses:

  • ESLint for code linting
  • Prettier for code formatting
  • TypeScript for type safety

To maintain consistency:

# Auto-format code
npm run format

# Auto-fix lint issues
npm run lint:fix

🀝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run validations (npm run validate)
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

Commit Message Format

Follow conventional commits:

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation changes
  • style: Code style changes (formatting, etc.)
  • refactor: Code refactoring
  • test: Adding or updating tests
  • chore: Maintenance tasks

πŸ› Troubleshooting

Port Already in Use

If port 3000 is in use, Vite will automatically use the next available port. You can also specify a port:

npm run dev -- --port 3001

Environment Variables Not Loading

  1. Ensure .env file exists in the root directory
  2. Restart the development server
  3. Check that variables start with VITE_
  4. Verify no syntax errors in .env

Build Errors

# Clear cache and reinstall
rm -rf node_modules package-lock.json
npm install

# Clear Vite cache
rm -rf node_modules/.vite

Firebase Connection Issues

  1. Check Firebase configuration in .env
  2. Ensure Firebase services are enabled in console
  3. Verify domain is authorized in Firebase Authentication settings

Mapbox Not Loading

  1. Verify Mapbox token is valid
  2. Check token has required scopes
  3. Ensure token is not restricted to other domains

πŸ“š Additional Documentation

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘₯ Team

πŸ™ Acknowledgments

πŸ“ž Support


Made with ❀️ for college students

Happy Ride Sharing! πŸš—πŸ’¨

About

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages