<a href="https://youtu.be/kmy_YNhl0mw" target="_blank">
<img src="https://i.ibb.co/Bf04Hpd/Readme-thumbnail-from-JS-Mastery.png" alt="Project Banner">
</a>
<img src="https://img.shields.io/badge/-React_Native-black?style=for-the-badge&logoColor=white&logo=react&color=61DAFB" alt="reactnative" />
<img src="https://img.shields.io/badge/-PostgreSQL-black?style=for-the-badge&logoColor=white&logo=postgresql&color=4169E1" alt="postgresql" />
<img src="https://img.shields.io/badge/-Expo-black?style=for-the-badge&logoColor=white&logo=expo&color=000020" alt="expo" />
<img src="https://img.shields.io/badge/-Stripe-black?style=for-the-badge&logoColor=white&logo=stripe&color=008CDD" alt="stripe" />
Build this project step by step with our detailed tutorial on <a href="https://www.youtube.com/@javascriptmastery/videos" target="_blank"><b>JavaScript Mastery</b></a> YouTube. Join the JSM family!
This repository contains the code corresponding to an in-depth tutorial available on our YouTube channel, JavaScript Mastery.
If you prefer visual learning, this is the perfect resource for you. Follow our tutorial to learn how to build projects like these step-by-step in a beginner-friendly manner!
Built with React Native for handling the user interface, Google Maps for rendering maps with directions, stripe for handling payments, serverless Postgres for managing databases, and styled with TailwindCSS, Uber Clone is a perfect mobile app. The primary goal is to demonstrate how to develop full-stack mobile applications to showcase the developer's skills in a unique manner that creates a lasting impact.
If you're getting started and need assistance or face any bugs, join our active Discord community with over 34k+ members. It's a place where people help each other out.
👉 Onboarding Flow: Seamless user registration and setup process.
👉 Email Password Authentication with Verification: Secure login with email verification.
👉 oAuth Using Google: Easy login using Google credentials.
👉 Authorization: Secure access control for different user roles.
👉 Home Screen with Live Location & Google Map: Real-time location tracking with markers on a map.
👉 Recent Rides: View a list of recent rides at a glance.
👉 Google Places Autocomplete: Search any place on Earth with autocomplete suggestions.
👉 Find Rides: Search for rides by entering 'From' and 'To' locations.
👉 Select Rides from Map: Choose available cars near your location from the map.
👉 Confirm Ride with Detailed Information: View complete ride details, including time and fare price.
👉 Pay for Ride Using Stripe: Make payments using multiple methods like cards and others.
👉 Create Rides After Successful Payment: Book a ride after confirming payment.
👉 Profile: Manage account details in the profile screen.
👉 History: Review all rides booked so far.
👉 Responsive on Android and iOS: Optimized for both Android and iOS devices.
and many more, including code architecture and reusability
Follow these steps to set up the project locally on your machine.
Prerequisites
Make sure you have the following installed on your machine:
Cloning the Repository
git clone https://github.com/JavaScript-Mastery-Pro/uber.git
cd uber
Installation
Install the project dependencies using npm:
npm install
Set Up Environment Variables
Create a new file named .env in the root of your project and add the following content:
EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY=
EXPO_PUBLIC_PLACES_API_KEY=
EXPO_PUBLIC_DIRECTIONS_API_KEY=
DATABASE_URL=
EXPO_PUBLIC_SERVER_URL=https://uber.dev/
EXPO_PUBLIC_GEOAPIFY_API_KEY=
EXPO_PUBLIC_STRIPE_PUBLISHABLE_KEY=
STRIPE_SECRET_KEY=
Replace the placeholder values with your actual Clerk, Stripe, NeonDB, Google Maps, andgeoapify credentials. You can obtain these credentials by signing up on the Clerk, Stripe, NeonDB, Google Maps and geoapify websites respectively.
Running the Project
npx expo start
Download the Expo Go app and Scan the QR code on your respective device to view the project.
Here are some code snippets from the project to help you get started quickly.
.vscode/settings.json
{
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
}
tailwind.config.js
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./app/**/*.{js,jsx,ts,tsx}", "./components/**/*.{js,jsx,ts,tsx}"],
theme: {
extend: {
fontFamily: {
Jakarta: ["Jakarta", "sans-serif"],
JakartaBold: ["Jakarta-Bold", "sans-serif"],
JakartaExtraBold: ["Jakarta-ExtraBold", "sans-serif"],
JakartaExtraLight: ["Jakarta-ExtraLight", "sans-serif"],
JakartaLight: ["Jakarta-Light", "sans-serif"],
JakartaMedium: ["Jakarta-Medium", "sans-serif"],
JakartaSemiBold: ["Jakarta-SemiBold", "sans-serif"],
},
colors: {
primary: {
100: "#F5F8FF",
200: "#EBF4FF",
300: "#C3D9FF",
400: "#9BBFFF",
500: "#0286FF",
600: "#6A85E6",
700: "#475A99",
800: "#364573",
900: "#242B4D",
},
secondary: {
100: "#F8F8F8",
200: "#F1F1F1",
300: "#D9D9D9",
400: "#C2C2C2",
500: "#AAAAAA",
600: "#999999",
700: "#666666",
800: "#4D4D4D",
900: "#333333",
},
success: {
100: "#F0FFF4",
200: "#C6F6D5",
300: "#9AE6B4",
400: "#68D391",
500: "#38A169",
600: "#2F855A",
700: "#276749",
800: "#22543D",
900: "#1C4532",
},
danger: {
100: "#FFF5F5",
200: "#FED7D7",
300: "#FEB2B2",
400: "#FC8181",
500: "#F56565",
600: "#E53E3E",
700: "#C53030",
800: "#9B2C2C",
900: "#742A2A",
},
warning: {
100: "#FFFBEB",
200: "#FEF3C7",
300: "#FDE68A",
400: "#FACC15",
500: "#EAB308",
600: "#CA8A04",
700: "#A16207",
800: "#854D0E",
900: "#713F12",
},
general: {
100: "#CED1DD",
200: "#858585",
300: "#EEEEEE",
400: "#0CC25F",
500: "#F6F8FA",
600: "#E6F3FF",
700: "#EBEBEB",
800: "#ADADAD",
},
},
},
},
plugins: [],
};
types/type.d.ts
import {TextInputProps, TouchableOpacityProps} from "react-native";
declare interface Driver {
driver_id: number;
first_name: string;
last_name: string;
profile_image_url: string;
car_image_url: string;
car_seats: number;
rating: number;
}
declare interface MarkerData {
latitude: number;
longitude: number;
id: number;
title: string;
profile_image_url: string;
car_image_url: string;
car_seats: number;
rating: number;
first_name: string;
last_name: string;
time?: number;
price?: string;
}
declare interface MapProps {
destinationLatitude?: number;
destinationLongitude?: number;
onDriverTimesCalculated?: (driversWithTimes: MarkerData[]) => void;
selectedDriver?: number | null;
onMapReady?: () => void;
}
declare interface Ride {
origin_address: string;
destination_address: string;
origin_latitude: number;
origin_longitude: number;
destination_latitude: number;
destination_longitude: number;
ride_time: number;
fare_price: number;
payment_status: string;
driver_id: number;
user_email: string;
created_at: string;
driver: {
first_name: string;
last_name: string;
car_seats: number;
};
}
declare interface ButtonProps extends TouchableOpacityProps {
title: string;
bgVariant?: "primary" | "secondary" | "danger" | "outline" | "success";
textVariant?: "primary" | "default" | "secondary" | "danger" | "success";
IconLeft?: React.ComponentType<any>;
IconRight?: React.ComponentType<any>;
className?: string;
}
declare interface GoogleInputProps {
icon?: string;
initialLocation?: string;
containerStyle?: string;
textInputBackgroundColor?: string;
handlePress: ({
latitude,
longitude,
address,
}: {
latitude: number;
longitude: number;
address: string;
}) => void;
}
declare interface InputFieldProps extends TextInputProps {
label: string;
icon?: any;
secureTextEntry?: boolean;
labelStyle?: string;
containerStyle?: string;
inputStyle?: string;
iconStyle?: string;
className?: string;
}
declare interface PaymentProps {
fullName: string;
email: string;
amount: string;
driverId: number;
rideTime: number;
}
declare interface LocationStore {
userLatitude: number | null;
userLongitude: number | null;
userAddress: string | null;
destinationLatitude: number | null;
destinationLongitude: number | null;
destinationAddress: string | null;
setUserLocation: ({
latitude,
longitude,
address,
}: {
latitude: number;
longitude: number;
address: string;
}) => void;
setDestinationLocation: ({
latitude,
longitude,
address,
}: {
latitude: number;
longitude: number;
address: string;
}) => void;
}
declare interface DriverStore {
drivers: MarkerData[];
selectedDriver: number | null;
setSelectedDriver: (driverId: number) => void;
setDrivers: (drivers: MarkerData[]) => void;
clearSelectedDriver: () => void;
}
declare interface DriverCardProps {
item: MarkerData;
selected: number;
setSelected: () => void;
}
types/image.d.ts
declare module "*.png" {
const value: any;
export default value;
}
declare module "*.jpg" {
const value: any;
export default value;
}
declare module "*.jpeg" {
const value: any;
export default value;
}
declare module "*.gif" {
const value: any;
export default value;
}
declare module "*.svg" {
const value: any;
export default value;
}
constants/index.ts
```ts import arrowDown from "@/assets/icons/arrow-down.png"; import arrowUp from "@/assets/icons/arrow-up.png"; import backArrow from "@/assets/icons/back-arrow.png"; import chat from "@/assets/icons/chat.png"; import checkmark from "@/assets/icons/check.png"; import close from "@/assets/icons/close.png"; import dollar from "@/assets/icons/dollar.png"; import email from "@/assets/icons/email.png"; import eyecross from "@/assets/icons/eyecross.png"; import google from "@/assets/icons/google.png"; import home from "@/assets/icons/home.png"; import list from "@/assets/icons/list.png"; import lock from "@/assets/icons/lock.png"; import map from "@/assets/icons/map.png"; import marker from "@/assets/icons/mar