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.
|
|
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
| 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 |
|
React |
TypeScript |
Vite |
Tailwind CSS |
Redux Toolkit |
Vercel |
| 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 |
# 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- Node.js 18.x or higher
- pnpm 8.x (recommended) or npm 9.x
- Git
- Modern web browser
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-keyClick 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
- 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
- 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
- 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
- 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
- Live ride status updates
- Driver location tracking
- Instant notifications
- Real-time availability changes
- Mobile-first approach
- Tablet and desktop optimizations
- Touch-friendly interactions
- Adaptive layouts
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
Routes are protected based on user roles:
/admin/*- Admin only/driver/*- Drivers only/user/*- Riders only
Unauthorized access attempts redirect to appropriate pages.
Click to view endpoints
/ β 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/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/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/analytics β Platform analytics
/admin/users β User management
/admin/drivers β Driver management
/admin/rides β All rides oversight{
auth: {
user: User | null,
token: string | null,
isAuthenticated: boolean
},
api: {
queries: {...},
mutations: {...}
}
}- authApi: Authentication operations
- userApi: User management
- driverApi: Driver operations
- adminApi: Admin features
- Dark and light mode support
- System preference detection
- Persistent theme selection
- Smooth theme transitions
/* 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%;sm: '640px' // Mobile
md: '768px' // Tablet
lg: '1024px' // Desktop
xl: '1280px' // Large Desktop
2xl: '1536px' // Extra Largepnpm dev # Start dev server
pnpm build # Build for production
pnpm preview # Preview production build
pnpm lint # Run ESLint# Build optimized production bundle
pnpm build
# Output directory: dist/
# The build is minified and optimized for performance# 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 --prodAdd these in your Vercel dashboard:
VITE_API_BASE_URLVITE_MAPBOX_TOKEN(optional)VITE_GOOGLE_MAPS_KEY(optional)
| Browser | Version |
|---|---|
| Chrome | Last 2 versions |
| Firefox | Last 2 versions |
| Safari | Last 2 versions |
| Edge | Last 2 versions |
The frontend integrates with the Velocia Backend API. See the Backend Documentation for API details.
// Development
const API_URL = "http://localhost:5000/api/v1";
// Production
const API_URL = "https://velocia-api.vercel.app/api/v1";// Client Side
URL = "https://velocia-official.vercel.app/";
// Server Side
URL = "https://velocia-api.vercel.app/";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 RequestVelocia - A enterprise-grade ride-sharing platform where every journey is just a ride away.
