Skip to content

Repository files navigation

Header

Fast Enterprise Grade Ride Sharing Application

Built with precision, designed for excellence

Velocia Frontend is a production-ready, high-performance web application for modern ride-sharing platforms. Built with cutting-edge technologies and best practices, it provides an intuitive, responsive, and feature-rich user experience across all devices.

Version React TypeScript Vite Tailwind

Deployed on Vercel Redux Toolkit License PRs Welcome

✨ Features

πŸ” Authentication & User Management

  • Secure Authentication with JWT tokens
  • Role-based Dashboards for riders, drivers, and admins
  • Profile Management with avatar upload
  • Password Management with reset functionality
  • OTP Verification for account security
  • Social Authentication ready architecture

πŸš— Ride Management

  • Real-time Ride Requests with live tracking

  • Interactive Map Integration for location selection

  • Ride History with detailed records

  • Active Ride Monitoring with emergency features

  • Driver Matching algorithm visualization

  • Fare Calculation and display

πŸ‘¨β€πŸ’Ό Multi-Role Support

  • Admin Dashboard with analytics
  • Driver Portal for ride management
  • Rider Interface for booking rides
  • User Management for admins
  • Earnings Tracking for drivers
  • Verification Workflows for driver applications

🎨 Modern UI/UX

  • Responsive Design across all devices

  • Dark/Light Mode theme support

  • Smooth Animations and transitions

  • Accessible Components with ARIA support

  • Interactive Charts and data visualization

  • Toast Notifications for user feedback


πŸ—ΊοΈ Application Architecture

graph TB
    subgraph "Presentation Layer"
        A[Public Pages]
        B[Authentication]
        C[User Dashboard]
        D[Driver Dashboard]
        E[Admin Dashboard]
    end

    subgraph "State Management"
        F[Redux Store]
        G[RTK Query]
        H[Local State]
    end

    subgraph "Service Layer"
        I[Auth API]
        J[User API]
        K[Driver API]
        L[Admin API]
    end

    subgraph "Backend Integration"
        M[Velocia API]
    end

    A & B & C & D & E --> F
    F --> G & H
    G --> I & J & K & L
    I & J & K & L --> M
Loading
Design Principle Description
🎯 Component-Based Modular, reusable components for scalability
πŸ“± Mobile-First Responsive design prioritizing mobile experience
⚑ Performance-Optimized Code splitting, lazy loading, and optimization
β™Ώ Accessibility-First WCAG compliant with full keyboard navigation
🎨 Theme Support Dark/light mode with system preference detection

πŸ› οΈ Tech Stack

Core Technologies

React
React
TypeScript
TypeScript
Vite
Vite
Tailwind
Tailwind CSS
Redux
Redux Toolkit
Vercel
Vercel

Additional Stack

Category Technologies Purpose
🎨 UI Components shadcn/ui Origin UI Accessible component library
πŸ“Š Data Visualization Shadcn Charts Charts and analytics
πŸ—ΊοΈ Maps & Location nominatim.openstreetmap Interactive maps
πŸ”„ State Management Redux Toolkit RTK Query Global state and API caching
πŸ“ Form Management React Hook Form Zod Form handling and validation
🎭 Icons Lucide React Modern icon library
πŸš€ Deployment Vercel Cloud deployment

πŸš€ Getting Started

⚑ Quick Installation

# 1. Clone the repository
git clone https://github.com/zahid-official/milestone-17-velociaClient.git
cd milestone-17-velociaClient

# 2. Install dependencies
pnpm install
# or
npm install

# 3. Set up environment variables
cp .env.example .env
# Edit .env with your configuration

# 4. Start development server
pnpm dev
# or
npm run dev

# 5. Access the application
# http://localhost:5173

πŸ“¦ Prerequisites

  • Node.js 18.x or higher
  • pnpm 8.x (recommended) or npm 9.x
  • Git
  • Modern web browser

πŸ”§ Environment Configuration

Click to view essential .env variables
# API Configuration
VITE_API_BASE_URL=http://localhost:5000/api/v1
# OR Production
# VITE_API_BASE_URL=https://velocia-api.vercel.app/api/v1

# Map Configuration (Optional)
VITE_MAPBOX_TOKEN=your-mapbox-token
VITE_GOOGLE_MAPS_KEY=your-google-maps-key

πŸ“ Project Structure

Click to view project folder structure
velocia-frontend/
β”œβ”€β”€ πŸ“„ Configuration Files
β”‚   β”œβ”€β”€ vite.config.ts              # Vite configuration
β”‚   β”œβ”€β”€ tsconfig.json               # TypeScript configuration
β”‚   β”œβ”€β”€ tailwind.config.js          # Tailwind CSS configuration
β”‚   β”œβ”€β”€ components.json             # shadcn/ui configuration
β”‚   └── vercel.json                 # Vercel deployment config
β”‚
β”œβ”€β”€ πŸ“ public/                      # Static assets
β”‚   β”œβ”€β”€ icons/                      # Application icons
β”‚   └── images/                     # Public images
β”‚
└── πŸ“ src/
    β”œβ”€β”€ πŸ“„ App.tsx                  # Root component
    β”œβ”€β”€ πŸ“„ main.tsx                 # Application entry point
    β”œβ”€β”€ πŸ“„ global.css               # Global styles
    β”‚
    β”œβ”€β”€ πŸ“ config/                  # Configuration
    β”‚   └── env.ts                  # Environment variables
    β”‚
    β”œβ”€β”€ πŸ“ constants/               # Application constants
    β”‚   β”œβ”€β”€ accountStatus.ts        # Account status enums
    β”‚   β”œβ”€β”€ availability.ts         # Driver availability
    β”‚   β”œβ”€β”€ rideStatus.ts          # Ride status enums
    β”‚   └── role.ts                # User role enums
    β”‚
    β”œβ”€β”€ πŸ“ context/                 # React contexts
    β”‚   └── Theme.context.ts       # Theme context
    β”‚
    β”œβ”€β”€ πŸ“ hooks/                   # Custom React hooks
    β”‚   β”œβ”€β”€ use-file-upload.ts     # File upload hook
    β”‚   β”œβ”€β”€ use-mobile.ts          # Mobile detection
    β”‚   β”œβ”€β”€ use-pagination.ts      # Pagination logic
    β”‚   β”œβ”€β”€ useDebounce.ts         # Debounce hook
    β”‚   └── useTheme.ts            # Theme management
    β”‚
    β”œβ”€β”€ πŸ“ lib/                     # Utilities
    β”‚   β”œβ”€β”€ axios.ts               # Axios configuration
    β”‚   └── utils.ts               # Helper functions
    β”‚
    β”œβ”€β”€ πŸ“ providers/               # Context providers
    β”‚   └── theme.provider.tsx     # Theme provider
    β”‚
    β”œβ”€β”€ πŸ“ redux/                   # State management
    β”‚   β”œβ”€β”€ store.ts               # Redux store
    β”‚   β”œβ”€β”€ hooks.ts               # Typed Redux hooks
    β”‚   β”œβ”€β”€ baseApi.ts             # RTK Query base
    β”‚   β”œβ”€β”€ axiosBaseQuery.ts      # Custom base query
    β”‚   └── features/              # Feature slices
    β”‚       β”œβ”€β”€ auth/              # Authentication
    β”‚       β”œβ”€β”€ user/              # User management
    β”‚       β”œβ”€β”€ driver/            # Driver operations
    β”‚       └── admin/             # Admin features
    β”‚
    β”œβ”€β”€ πŸ“ routes/                  # Routing configuration
    β”‚   β”œβ”€β”€ index.tsx              # Main routes
    β”‚   β”œβ”€β”€ admin/                 # Admin routes
    β”‚   β”œβ”€β”€ driver/                # Driver routes
    β”‚   └── user/                  # User routes
    β”‚
    β”œβ”€β”€ πŸ“ types/                   # TypeScript types
    β”‚   β”œβ”€β”€ auth.types.ts          # Auth types
    β”‚   β”œβ”€β”€ driver.types.ts        # Driver types
    β”‚   β”œβ”€β”€ user.types.ts          # User types
    β”‚   └── index.ts               # Barrel exports
    β”‚
    β”œβ”€β”€ πŸ“ utils/                   # Utility functions
    β”‚   β”œβ”€β”€ generateRoutes.ts      # Route generation
    β”‚   β”œβ”€β”€ generateSidebar.ts     # Sidebar generation
    β”‚   β”œβ”€β”€ geo.ts                 # Geolocation utilities
    β”‚   └── withAuth.tsx           # Auth HOC
    β”‚
    β”œβ”€β”€ πŸ“ components/
    β”‚   β”œβ”€β”€ πŸ“ layout/             # Layout components
    β”‚   β”‚   β”œβ”€β”€ CommonLayout.tsx   # Public layout
    β”‚   β”‚   β”œβ”€β”€ DashboardLayout.tsx # Dashboard layout
    β”‚   β”‚   β”œβ”€β”€ Footer.tsx         # Footer component
    β”‚   β”‚   β”œβ”€β”€ Navbar.tsx         # Navigation bar
    β”‚   β”‚   └── ThemeToggler.tsx   # Theme switcher
    β”‚   β”‚
    β”‚   β”œβ”€β”€ πŸ“ ui/                 # UI components (shadcn/ui)
    β”‚   β”‚   β”œβ”€β”€ button.tsx         # Button component
    β”‚   β”‚   β”œβ”€β”€ input.tsx          # Input component
    β”‚   β”‚   β”œβ”€β”€ card.tsx           # Card component
    β”‚   β”‚   β”œβ”€β”€ dialog.tsx         # Modal dialogs
    β”‚   β”‚   β”œβ”€β”€ table.tsx          # Table component
    β”‚   β”‚   β”œβ”€β”€ chart.tsx          # Chart components
    β”‚   β”‚   └── ...                # Other UI components
    β”‚   β”‚
    β”‚   └── πŸ“ modules/            # Feature modules
    β”‚       β”œβ”€β”€ authentication/    # Auth forms
    β”‚       β”œβ”€β”€ Public/           # Public pages
    β”‚       β”œβ”€β”€ user/             # User features
    β”‚       └── driver/           # Driver features
    β”‚
    └── πŸ“ pages/                  # Page components
        β”œβ”€β”€ admin/                 # Admin pages
        β”œβ”€β”€ driver/               # Driver pages
        β”œβ”€β”€ user/                 # User pages
        └── public/               # Public pages

🎨 Key Features

Authentication System

  • Secure JWT-based authentication
  • Role-based access control (Admin, Driver, Rider)
  • Protected routes with automatic redirection
  • Persistent login with refresh tokens
  • OTP verification for account security

Dashboard Interfaces

Rider Dashboard

  • Quick ride request form with location autocomplete
  • Real-time ride tracking with map visualization
  • Ride history with detailed records
  • Profile management with avatar upload
  • Emergency contacts management

Driver Dashboard

  • Availability toggle for online/offline status
  • Incoming ride requests with accept/reject actions
  • Current ride management with status updates
  • Earnings tracker with detailed breakdown
  • Vehicle information management
  • Ride history and statistics

Admin Dashboard

  • Comprehensive analytics with interactive charts
  • User management with block/unblock capabilities
  • Driver verification and approval workflow
  • Ride oversight with detailed monitoring
  • Platform statistics and metrics

Real-time Features

  • Live ride status updates
  • Driver location tracking
  • Instant notifications
  • Real-time availability changes

Responsive Design

  • Mobile-first approach
  • Tablet and desktop optimizations
  • Touch-friendly interactions
  • Adaptive layouts

πŸ” Authentication & Authorization

Login Credentials for Testing

Click to view login credentials
Admin Account:
Email: default@email.com
Password: default@Admin123

Driver Account:
Email: driver@email.com
Password: default@Admin123

Rider Account:
Email: rider@email.com
Password: default@Admin123

Protected Routes

Routes are protected based on user roles:

  • /admin/* - Admin only
  • /driver/* - Drivers only
  • /user/* - Riders only

Unauthorized access attempts redirect to appropriate pages.

Routing Structure

Click to view endpoints

Public Routes (No Authentication Required)

/                    β†’ Home page
/about              β†’ About us
/features           β†’ Platform features
/faq                β†’ Frequently asked questions
/contact            β†’ Contact form
/login              β†’ Login page
/register           β†’ Registration (Rider/Driver)
/verify             β†’ OTP verification

Protected Routes (Authentication Required)

Rider Routes (/user/*)

/user/ride-request     β†’ Request a new ride
/user/active-ride      β†’ Current active ride
/user/ride-history     β†’ Past rides with filters
/user/profile          β†’ Profile management
/user/change-password  β†’ Password update
/user/emergency        β†’ Emergency contacts

Driver Routes (/driver/*)

/driver/availability      β†’ Toggle online/offline
/driver/requests          β†’ Incoming ride requests
/driver/current-ride      β†’ Active ride management
/driver/earnings          β†’ Earnings dashboard
/driver/history           β†’ Completed rides
/driver/vehicle-info      β†’ Vehicle details

Admin Routes (/admin/*)

/admin/analytics         β†’ Platform analytics
/admin/users             β†’ User management
/admin/drivers           β†’ Driver management
/admin/rides             β†’ All rides oversight

πŸ“Š State Management

Redux Store Structure

{
  auth: {
    user: User | null,
    token: string | null,
    isAuthenticated: boolean
  },
  api: {
    queries: {...},
    mutations: {...}
  }
}

RTK Query API's

  • authApi: Authentication operations
  • userApi: User management
  • driverApi: Driver operations
  • adminApi: Admin features

🎨 Styling & Theming

Theme System

  • Dark and light mode support
  • System preference detection
  • Persistent theme selection
  • Smooth theme transitions

Color Palette

/* Light Mode */
--primary: 222.2 47.4% 11.2% --secondary: 210 40% 96.1% --accent: 210 40% 96.1%
  /* Dark Mode */ --primary: 210 40% 98% --secondary: 217.2 32.6% 17.5%
  --accent: 217.2 32.6% 17.5%;

Responsive Breakpoints

sm: '640px'   // Mobile
md: '768px'   // Tablet
lg: '1024px'  // Desktop
xl: '1280px'  // Large Desktop
2xl: '1536px' // Extra Large

πŸš€ Build & Deployment

Development

pnpm dev          # Start dev server
pnpm build        # Build for production
pnpm preview      # Preview production build
pnpm lint         # Run ESLint

Production Build

# Build optimized production bundle
pnpm build

# Output directory: dist/
# The build is minified and optimized for performance

Deploy to Vercel

Deploy with Vercel

Manual Deployment

# Install Vercel CLI
npm i -g vercel

# Deploy
vercel

# Set environment variables in Vercel dashboard
# or via CLI
vercel env add VITE_API_BASE_URL

# Deploy to production
vercel --prod

Environment Variables in Vercel

Add these in your Vercel dashboard:

  • VITE_API_BASE_URL
  • VITE_MAPBOX_TOKEN (optional)
  • VITE_GOOGLE_MAPS_KEY (optional)

πŸ“± Browser Support

Browser Version
Chrome Last 2 versions
Firefox Last 2 versions
Safari Last 2 versions
Edge Last 2 versions

πŸ”„ API Integration

The frontend integrates with the Velocia Backend API. See the Backend Documentation for API details.

Base URL Configuration

// Development
const API_URL = "http://localhost:5000/api/v1";

// Production
const API_URL = "https://velocia-api.vercel.app/api/v1";

Live Overview URL

// Client Side
URL = "https://velocia-official.vercel.app/";

// Server Side
URL = "https://velocia-api.vercel.app/";

🌟 Author

Zahid Official

Zahid Official

Web Developer | Tech Enthusiast

GitHub LinkedIn Email

Built with passion and dedication to create scalable solutions


🀝 Contributing

Contributions make the open source community amazing! Any contributions you make are greatly appreciated.

1. Fork the Project
2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
3. Commit your Changes (git commit -m 'Add some AmazingFeature')
4. Push to the Branch (git push origin feature/AmazingFeature)
5. Open a Pull Request

Velocia - A enterprise-grade ride-sharing platform where every journey is just a ride away.

About

πŸš€ Velocia is a web application for a ride sharing platform featuring role based dashboards, ride management and responsive UI built with React, TypeScript and modern frontend tools.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages